B
bsense
Unregistered / Unconfirmed
GUEST, unregistred user!
求一条等效,更加简洁语句<br>select * from (select convert(varchar(10),dates,120) as dates,count(convert(varchar(10),dates,120)) as qty2,sum(amount) as amount<br> from cashs where convert(varchar(10),dates,120)>=:date1 and convert(varchar(10),dates,120)<=:date2 group by convert(varchar(10),dates,120)  a,<br> (select convert(varchar(10),dates,120) as dates,sum(qty) as qty <br> from cashs a,cashdetail b where a.ticket_no=b.cash_id and convert(varchar(10),dates,120)>=:date1 and convert(varchar(10),dates,120)<=:date2 group by convert(varchar(10),dates,120)) b <br>where a.dates=b.dates