在(普适控制中心)的以下查询中,我尝试将两个字段l.qtyordered
x l.unitpricet
简单地相乘为ExtPrice。我在MS SQL中整天都在做的事情,但在PSQL中,它看起来并不是同样的格式。非常感谢您的帮助。两者都是db中的小数,因此它不应该是数据类型问题。我尝试使用Sum()
,尝试cast()
更改每个,但没有任何效果。
--Open Orders Line
select distinct h.ordernumber, h.orderstatus, h.customerkey, h.customername, h.shiptokey,
h.shiptoName, h.shiptostate, h.orderdate, h.requestdate, h.customerponumber, h.salespersonkey,
l.itemkey, l.itemdescription, l.desc2, (l.qtyordered) x (l.unitprice) as ExtPrice
from "OEHDR_DBM" h
Left join oelin_dbm l ON l.sysdocid = h.sysdocid
where h.orderstatus not in ('C','S','QW','QP','QN')
and l.qtyremaining >0
Group by h.ordernumber, h.orderstatus, h.customerkey, h.customername,h.shiptokey,
h.shiptoName, h.shiptostate, h.orderdate, h.requestdate, h.customerponumber, h.salespersonkey,
l.itemkey, l.itemdescription, l.desc2, l.qtyordered, l.unitprice
--having count(h.ordernumber) =1
Order by h.Requestdate