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 |
nord
Posting Yak Master
126 Posts |
Posted - 2013-04-09 : 13:57:31
|
Hi,I have data of invoices and each invoice have 2 status (2 line)sale and billedHow I can select invoice which have status sale but dont have status billedThanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-09 : 14:54:10
|
[code]SELECT *FROM(SELECT *,SUM(CASE WHEN status='billed' THEN 1 ELSE 0 END) OVER (PARTITION BY InvoiceID) AS CntFROM table)tWHERE Cnt =0[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
nord
Posting Yak Master
126 Posts |
Posted - 2013-04-09 : 15:37:44
|
Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-10 : 00:50:59
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|