如果条件一样sql2 和sql3可以写到一起。 select sum(a1)as a1, sum(a2)as a2 from ** where ***** sql1就是一个数据集了.
select * from table1 UNION select * from table2 ??????????????????
以前好像有人问过.这里有个例子.select套 select 随便怎么折腾都可以^^v select a.projectID,a.createTime,a.projectState,a.principal, lastOnlineTime=(select max(b.updateTime) from OnlineRecordTable as b where b.projectID=a.projectID), lastBugTime=(select max(c.revealTime) from BugRecordTable as c where c.projectID=a.projectID)from BaseInfoTable as a where a.projectID=2
sql="";
sql+=...;
sql+=........;
select sum(a1)as a1, sum(a2)as a2 from ** where *****
sql1就是一个数据集了.
??????????????????
select a.projectID,a.createTime,a.projectState,a.principal,
lastOnlineTime=(select max(b.updateTime)
from OnlineRecordTable as b
where b.projectID=a.projectID), lastBugTime=(select max(c.revealTime)
from BugRecordTable as c
where c.projectID=a.projectID)from BaseInfoTable as a
where a.projectID=2