SQL custom all value %


I’ve faced with a strange issue. I’m trying to compose a table based on SQL query. I added some variables and everything works great. But I need to add All value. I customized it as % and it also works, but for some reason all other options in the same variable stop working. I mean, if I chose All the table is populated, but if I chose anything else it returns nothing.

I tested query itself by putting values directly without any variables and it works.

My variable is

Query is

SELECT hsts.hostid as ‘ID’,
hsts.name as ‘HOSTNAME’,
intf.ip as ‘IP’,
grps.groupid as ‘GROUPID’,
grps.name as ‘GROUP’,
inv.type as ‘TYPE’,
inv.vendor as ‘VENDOR’,
inv.type_full as ‘LOC_TYPE’,
inv.serialno_a as ‘SN’,
inv.location as ‘LOCATION’,
inv.notes as ‘NOTES’,
inv.model as ‘MODEL’,
inv.contract_number as ‘CONTACT’,
inv.site_address_a as ‘ADDRESS’,
inv.site_city as ‘CITY’,
inv.site_state as ‘STATE’,
inv.site_country as ‘COUNTRY’,
inv.site_zip as ‘ZIP’
FROM hosts as hsts
INNER JOIN host_inventory as inv
ON hsts.hostid = inv.hostid
INNER JOIN hosts_groups as hst2grp
ON hsts.hostid = hst2grp.hostid
INNER JOIN hstgrp as grps
ON hst2grp.groupid = grps.groupid
INNER JOIN interface as intf
ON hsts.hostid = intf.hostid
AND inv.vendor LIKE “$vendor”

what is the query generate and sent (the interpolated one) , check the Generated SQL in the query editor

Sorry, I didn’t know about this option…

So, the query with variable is

inv.vendor LIKE “$vendor”

With % sign the actual query is

inv.vendor LIKE “%

With any other value it looks like this(two extra ')

inv.vendor LIKE “aruba

Which is kind of strange, right?..
Grafana v5.3.4 (69630b9)

Seems like I managed to resolve the issue by adding
inv.vendor LIKE “[[vendor:csv]]”