sql server - SQL Query where a specific column should have two specific values but have just one -


sorry cryptic title, didn't find better question

i have table lets these data:

table article  id    articlenumber    type 1     10               1 2     10               3 3     20               1 4     30               1 5     30               3 

i'm looking 3. row no type 3 article exists type 1 article exists.

i think have easy sql query can't find solution...

to articlenumbers exists row type = 1 there no row type = 3, use this:

select   *   article   a.`type` = 1   , not exists (     select *       article a2           a2.`type` = 3       , a2.articlenumber = a.articlenumber   ) 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -