我有一张有结构的table
TicketID - ID of the Ticket
CreateTime - Time when the ticket is created
FinishTime - Time when the ticket is finished handled
我的目标是根据小时数找出这些值
Number of Tickets Received per hour
Number of Tickets handled per hour
到目前为止,我有两个不同的问题
Select count(Receipt.ID) as ReceiveCount,
Receipt.hours as PST,
(Receipt.hours+12.5) as IST
from
(Select ReceiptScanRequestTable.ReceiptScanRequestID as ID,
from_unixtime(CreateTime/1000 , '%H') as hours
from
ReceiptScanRequestTable
where
CreateTime>{hour_filter_value}
) as Receipt
Group By
Receipt.hours
这将返回每小时收到的票数
Select count(Receipt.ID) as FinishCount,
Receipt.hours as PST,
(Receipt.hours+12.5) as IST
from
(Select ReceiptScanRequestTable.ReceiptScanRequestID as ID,
from_unixtime(FinisheTime/1000 , '%H') as hours
from
ReceiptScanRequestTable
where
CreateTime>{hour_filter_value}
) as Receipt
Group By
Receipt.hours
这将返回每小时完成的票数
我的目标是将这两个查询组合成一个查询!
2条答案
按热度按时间798qvoo81#
试试这个:
ogsagwnx2#
你可以用
union all
然后聚合: