I have a table and need to return distinct data and its count. I'm doing this on 2 different column but haven't met any luck since. Here is an example of what i'm trying to do.
╔════════╦════════════╦══════╦═════════════╗
║ Fog ║ Count(fog) ║ Snow ║ Count(snow) ║
╠════════╬════════════╬══════╬═════════════╣
║ LA01 ║ 1123 ║ NWC ║ 109 ║
║ SIU ║ 3665 ║ SIS ║ 64 ║
║ CHARTN ║ 444 ║ PHS ║ 120 ║
╚════════╩════════════╩══════╩═════════════╝
I tried this query but did work
SELECT fog, count(fog), snow, count(snow) FROM message
WHERE arrival_timestamp >= (now() - '48 hour'::INTERVAL) GROUP BY fog, snow
When i tried this, i had the same value for the 2 counts which is incorrect.