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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-04-25 : 22:46:12
|
Gary writes "I still can't get my query to give me a total of each column and then show the results in a decending order.
Here is the original query:
SELECT LPwebsite, LPMarlinBoards, LPSabreStars, LPEMail, LPMemoInMailbox, LPSAI, LPHI6, LPOtherBulletinBoards, LPVideotapes, LPInsideDFW, LPSabreSineIn, LPVideoOnTheWeb FROM password
The results appear as this:
LPwebsite LPMarlinBoards LPSabreStars LPEMail ..........1................1...................0................0 ..........1................0...................0................0 ..........1................0...................0................0 ..........1................0...................1................0 ..........1................0...................0................0 ..........1................0...................0................0 ..........1................0...................0................0
LPmemoInMailbox LPSAI LPHI6 LPOtherBulletinBoards ..........1................1...................0................0 ..........1................1...................0................1 ..........0................1...................0................0 ..........1................1...................0................0 ..........1................1...................0................0 ..........0................1...................0................0 ..........1................0...................0................0
LPVideotapes LPInsideDFW LPSabreSineIn LPVideoOnTheWeb 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Here is the query that gives me the SUM of each column:
SELECT(Sum (lpwebsite)) as DFWWebsite, (sum(LPMarlinBoards)) as MarlinBoards, (sum(LPSabreStars)) as SabreStars, (sum(LPEMail)) as EMail, (sum(LPMemoInMailbox)) as Memoinmailbox, (sum(LPSAI)) as SAI, (sum(LPHI6)) as HI6, (sum(LPOtherBulletinBoards)) as OtherBulletinBoards, (sum(LPVideotapes)) as VideoTapes, (sum(LPInsideDFW)) as InsideDFW, (sum(LPSabreSineIn)) as Sabresinein, (sum(LPVideoOnTheWeb)) as VideoOnTheWeb FROM password
Here are the results.
LPwebsite LPMarlinBoards LPSabreStars LPEMail ..........7..........1............1..........0
LPmemoInMailbox LPSAI LPHI6 LPOtherBulletinBoards ..........5...........6............0............1
LPVideotapes LPInsideDFW LPSabreSineIn LPVideoOnTheWeb 0 0 0 0
Is there anyway I can get the totals of each column and the show the results in a decending order?
ie:
LPwebsite LPSAI LPmemoInMailbox LPMarlinBoards ...........7.............6..............5...........1
LPSabreStars LPOtherBulletinBoards LPHI6 LPEMail .............1..............1...............0............0
LPVideotapes LPInsideDFW LPSabreSineIn LPVideoOnTheWeb 0 0 0 0
I tried:
ORDER BY 2 DESC that graz suggested, but nothing happened.
Anyone have any suggestions.
Thanks.
Gary Costigan Dallas, Tx." |
|
|
|
|
|
|
|