Issue with All Option in variable using Postgresql

Hi guys! I am having problems with the All option in grafana.

I am graphing pings to sites through two hosts, I have the hosts stored in the raspberry_host column of my postgres table.

When graphing each host everything is fine but when selecting the all option it joins the points of the graphs and does not show them individually for each host.

Postgres Table::

image

Selecting one host:

Selecting option all:

Here is my query in grafana:

SELECT
timestamp AS “time”,
time_ms AS “Youtube $raspberry_host”
FROM
ping_data
WHERE
host = ‘youtube’
AND (
raspberry_host in($raspberry_host)
)
AND $__timeFilter(timestamp)

ORDER BY
timestamp;

Can someone help me please?

Select and group by raspberry_host (maybe also host - it is not clear how exactly you want to group), e.g. (example, not copy&paste solution - fix any syntax issues eventually):

SELECT
  timestamp AS "time",
  raspberry_host  AS "raspberry_host",
  time_ms AS "Youtube $raspberry_host"
FROM ping_data
WHERE
  host = 'youtube'
  AND raspberry_host in($raspberry_host)
  AND $__timeFilter(timestamp)
GROUP BY 2
ORDER BY 1

Thank you very much Jangara, I have already solved the problem!