日期:2014-05-18 浏览次数:20608 次
select count(*) from dbo.T_Money as tm left join dbo.T_Item as ti on tm.ID =ti.ID where ti.item ='AAA' and tm.[datetime] between '2012-03-01' and '2012-03-21' order by tm.ID DESC
------解决方案--------------------
select count(*) from dbo.T_Money as tm left join dbo.T_Item as ti on tm.ID =ti.ID where ti.item ='AAA' and tm.[datetime] between '2012-3-01' and '2012-3-21' order by tm.ID DESC
------解决方案--------------------
select count(*) from dbo.T_Money as tm left join dbo.T_Item as ti on tm.ID =ti.ID where ti.item ='AAA' and(tm.[datetime] between '2012-3-01' and '2012-3-21') order by tm.ID DESC
------解决方案--------------------
你这个count 就会返回一个值 无需加order by
select count(tm.ID) from dbo.T_Money as tm left join dbo.T_Item as ti on tm.ID =ti.ID where ti.item ='AAA' and tm.[datetime] between '2012-03-01' and '2012-03-21'
------解决方案--------------------
把你的left join 改成inner join 试试看
------解决方案--------------------
一个是ORDER BY的对象不在查询对象中吧