如何从字符串转换日期时间

时间:2014-03-26 04:47:41

标签: c# asp.net sql

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;

2 个答案:

答案 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;