【数据库_Postgresql】sql语句添加序号,timestamp格式时间截取日期和时间

时间:2022-05-08 04:08:03
SELECT
ROW_NUMBER() OVER (ORDER BY sr.receiptid ASC) AS 序号,
sr.receiptid,
sr.receiptdate,
DATE(sr.receiptdate) AS receiptdate,
concat_ws(':',EXTRACT(hour from sr.receiptdate),EXTRACT(minute from sr.receiptdate),EXTRACT(second from sr.receiptdate)) AS receipttime,
spm.ponumber,
spm.status,
sim.displayitemnumber,
sim.itemnumber,
sim.description,
sr.huid,
sr.qtyreceived
FROM
sp_receipts sr
LEFT JOIN sp_po_main spm ON sr.ponumber = spm.ponumber
LEFT JOIN sp_item_main sim ON sr.itemnumber=sim.itemnumber

postgresql的timestamp格式的时间如何以日期和时间分别列出来

【数据库_Postgresql】sql语句添加序号,timestamp格式时间截取日期和时间