简体   繁体   English

SELECT COUNT DISTINCT 作为列

[英]SELECT COUNT DISTINCT as columns

I have a table like this in psql db我在 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; SELECT filetype,COUNT(filetype),time FROM factbucketmetrics WHERE operation = 'INSERT' GROUP BY time,filetype;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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