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 |
|
PHUser
Starting Member
11 Posts |
Posted - 2010-05-14 : 12:08:16
|
| ShippingDetailsID IsShipped1 12 13 04 0I need to check if all rows returned in the where clause have IsShipped = 1. Let's say where clause filters ID 1 and 2.How can this be acheived? |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-05-14 : 13:03:35
|
| Why you want to check it again once you have put the condition IsShipped=1 in the where clause.PBUH |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-14 : 13:03:43
|
just addSELECT othercolumnsFROM(SELECT othercolumns, SUM(CASE WHEN IsShipped=0 THEN 1 ELSE 0 END) OVER () AS NonShippedFROM TableWHERE ID IN (1,2))tWHERE NonShipped=0 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|