title: Multiple series with one query in Grafana using PostgresQL as datasource
body: <p>I have data in a Postgres table with roughly this form:</p>
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE jobs
  (
      id              BIGINT PRIMARY KEY,
      started_at      TIMESTAMPTZ,
      duration        NUMERIC,
      project_id      BIGINT
  )
  </code></pre>
  <p>I also came up with a query that is kinda what I want:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT
    $__timeGroupAlias(started_at,$__interval),
    avg(duration) AS &quot;durations&quot;
  FROM jobs
  WHERE
    project_id = 720
  GROUP BY 1
  ORDER BY 1
  </code></pre>
  <p>This query filters for one exact <code>project_id</code>. What I actually want is one line in the chart <em>for each</em> project that has an entry in the table, not for just one.</p>
  <p>I fail to find a way to do that. I tried all different flavors of <code>group by</code> clauses I could think of, and also tried the examples I found online but none of them worked.</p>