SELECT pnr.PS_ID as 'รหัส',ca.DateTime as 'เวลาที่เติมเงิน'
From tbl_PNR nr inner join tbl_caLog_up_money ca on pnr.Mifare_No=ca.uMifaire
inner join tbl_caShift cs on CONVERT(nvarchar(10),cs.shDate, 126)=CONVERT(nvarchar(10),ca.uDateTime,126)
inner join User_ID cu on caUser_ID=shUser_ID
WHERE CONVERT(nvarchar(10),cs.shDate,126)='2012-09-01'
AND DATEDIFF(HH,cs.shSTime,cs.shETime)=0
AND CONVERT(nvarchar(10),cs.shSTime,114) >= '06:00:00'
AND CONVERT(nvarchar(10),cs.shETime,114) <= '12:00:00'
ORDER by pnr.PS_ID asc
Tag : ASP.NET MySQL, Ms SQL Server 2008, Web (ASP.NET), C#, VS 2010 (.NET 4.x)