Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
zippy
Yak Posting Veteran
69 Posts |
Posted - 2001-10-15 : 17:53:56
|
| another questiong on subqueries.Is it possible to do a computation on values from a subquery,for example I am using the following code (simplified somewhat): ISNULL((SELECT TOP 1 SUM(sub.TotalLoved) AS TotalLoved FROM tblLoved sub INNER JOIN tblPeople sub2 ON sub.PersonID = sub2.PersonID GROUP BY sub.PersonID, sub.DayLoved HAVING sub.PersonID = qry.PersonID ORDER BY sub.PersonID, sub.DayLoved), 0) AS Thursday, ISNULL((SELECT TOP 1 SUM(sub.TotalLoved) AS TotalLoved FROM tblLoved sub INNER JOIN tblPeople sub2 ON sub.PersonID = sub2.PersonID GROUP BY sub.PersonID, sub.DayLoved HAVING sub.PersonID = qry.PersonID ORDER BY sub.PersonID, sub.DayLoved), 0) AS FridayI know want to add the coloums Thursday and Friday together to make a total column,is that possible?I have tried goingTotal AS Thursday+Fridaybut that does not seem to workThanksCheck out the worlds fastest computers at http://www.ocgurus.com |
|
|
|
|
|