JSP结果集显示与SQL语句count和sum问题 我真服了这变态问题怎么就让我遇着了呢 哪位能帮个忙啊
我的SQL语句是这样的:
select f_calladdr,count(f_calladdr) as i,sum(F_long) as s,name,phone
from Tab_Ph6 as t,users as u
where u.id=t.f_calladdr and year(F_Date)= '2007 'and month(F_Date)= '6 ' and day(F_Date)= '7 ' and F_Long> 120 and UserZu between 1 and 5
group by f_calladdr,name,phone
order by sum(F_long) desc
这个在数据库中查询没什么问题,可以显示出所有记录,但是拿到JSP页面中用RS循环输出的时候,却会出现丢掉记录的情况,比如说在数据库中查出10条,但是在我JSP页面里却只有3条。
当我把order by sum(F_long) desc去了后一切OK!
当我把and year(F_Date)= '2007 'and month(F_Date)= '6 ' and day(F_Date)= '7 ' 去了也一切OK,就是在一起放在JSP页面中时会出问题!
可是数据库中确实能查出来的东西!
晕!
有哪位高手知道啊!帮帮忙!先谢谢了!
------解决方案--------------------order后面有问题吧,能这样吗。
------解决方案--------------------select f_calladdr,count(f_calladdr) as i,sum(F_long) as s,name,phone
from Tab_Ph6 as t,users as u
where u.id=t.f_calladdr and year(F_Date)= '2007 'and month(F_Date)= '6 ' and day(F_Date)= '7 ' and F_Long> 120 and UserZu between 1 and 5
group by f_calladdr,name,phone
order by sum(F_long) desc
--------------------------------
这里select f_calladdr,count(f_calladdr) as i 的count有意义吗?不就是1吗?还要group by f_calladdr,不知道你是怎么写出这么个sql的.