怎样把得到三条select语句里的得字段放在一个集合里,其中两条select是sum(),在数据库中没有该字段,求解,最好能告诉我代码,谢谢?
第一条:select ad.aid,ad.atype,ad.aaddress from address ad,arlink ar where ar.aid=ad.aid and afunction=0 and aenable=1第二条:select sum(rmseatno) from room group by aid
第三条:select sum(c.stus) from (select b.aid,count(ts.uid) as stus from tslink ts,(select ar.aid,te.uid from telink te,arlink ar where te.arid=ar.arid) b where b.uid=ts.uid) c group by c.aid;
想把 aid , atype , aaddress , sum(rmseatno) , sum(c.stus)放在一个集合里怎么写代码?帮忙一下.... --------------------编程问答-------------------- select ad.aid,ad.atype,ad.aaddress,sum(r.rmseatno) as rmseatNo , sum(c.stus) as stus
from address ad,arlink ar , room r ,(select b.aid,count(ts.uid) as stus from tslink ts,(select ar.aid,te.uid from telink te,arlink ar where te.arid=ar.arid) b where b.uid=ts.uid) c where ar.aid=ad.aid and afunction=0 and aenable=1
afunction=0 and aenable=1 这两个字段是在那个表里面的 ,把前缀加上
直接写到一条上去不行 ? --------------------编程问答-------------------- 查询出来,扔在map里面? --------------------编程问答-------------------- 因为觉得这样写sql太长所以想分开写然后把它放在一个集合里 --------------------编程问答-------------------- 怎么放map里,是单个select的内容放进去还是一楼那个放进去?
补充:Java , Eclipse