select dbo.CLOI_ClientOrderItems.cl_id, sum(dbo.IN_Invoices.in_total) as Total
from CLOI_ClientOrderItems
inner join IN_Invoices on CLOI_ClientOrderItems.MasterOrderId=IN_Invoices.MasterOrderId
where dbo.IN_Invoices.in_date_issued='2014-01-21 12:30:51.190'
group by cl_id;
答案 0 :(得分:3)
尝试
select
dbo.CLOI_ClientOrderItems.cl_id,
sum(dbo.IN_Invoices.in_total) as Total
from
CLOI_ClientOrderItems
inner join IN_Invoices
on
CLOI_ClientOrderItems.MasterOrderId=IN_Invoices.MasterOrderId
where
dbo.IN_Invoices.in_date_issued=CONVERT(datetime, '2014-01-21 12:30:51.190', 120)
答案 1 :(得分:1)
试试这个
select dbo.CLOI_ClientOrderItems.cl_id, sum(dbo.IN_Invoices.in_total) as Total
from CLOI_ClientOrderItems
inner join IN_Invoices on CLOI_ClientOrderItems.MasterOrderId=IN_Invoices.MasterOrderId
where dbo.IN_Invoices.in_date_issued=CAST('2014-01-21 12:30:51.190' AS Date)
group by cl_id;