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 |
robsbiz
Starting Member
3 Posts |
Posted - 2006-03-12 : 06:06:55
|
I have been strugling with for hours -I have a table with the following columnsUID(decimal) | SD(bit) | MB(bit) | TS(bit) | Total(Decimal)I want to run a query which will return UID, Total if SD is True AND UID, Total if MB is True ANDUID, Total if TS is TrueUID is the userID so there would be a WHERE statementORDERED BY Total DescendingMany thanks in advance |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2006-03-12 : 06:43:04
|
Is this homework?SELECT YourTable.UID, YourTable.TotalFROM YourTableWHERE YourTable.SD = 1 AND YourTable.MB = 1 AND YourTable.TS = 1ORDER BY YourTable.Total DESC |
 |
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-03-12 : 09:37:51
|
robsbiz,Can u provide with some data and the expected results |
 |
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2006-03-12 : 15:22:38
|
check BOL for the CASE statement.-ec |
 |
|
|
|
|