The following SQL syntax is a valid one.
SELECT
a.state,
sum(b.num_cars) * 10000.0/sum(a.data_2015) as proportion
FROM population as a
INNER JOIN "all" AS b
ON
a.state = b.state
WHERE a.state IN ('CA', 'TX', 'AZ')
GROUP BY
a.state
ORDER BY
proportion ASC
How can I achieve the following?
SELECT
a.state,
sum(b.num_cars) * 10000.0/sum(a.data_2015) as proportion
FROM population as a
INNER JOIN "all" AS b
ON
a.state = b.state
[[ WHERE a.state IN ({{state}}) ]]
GROUP BY
a.state
ORDER BY
proportion ASC
The focus is on the optional WHERE statement that should take a list of states (arguments).
Thank you.