简体   繁体   中英

SELECT COUNT DISTINCT as columns

I have a table like this in psql db在此处输入图片说明

i want to query output like this :

在此处输入图片说明

each column is showing count of that filetype in a timestamp. What will be the query? Any help will be much appreciated. :)

Figured it out :

SELECT filetype,COUNT(filetype),time FROM factbucketmetrics WHERE operation = 'INSERT' GROUP BY time,filetype;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM