Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how can exclude id with having multiple value?

i have 3 store_id (0,1,6) . i only want to get id have storeid <> 0 , but 24340 also have storeid =0 , i also want remove it too

Original:

valueid   store_id
24346     6
24345     6
24345     1
24344     0
24340     6
24340     1
24340     0

Expected:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

valueid   store_id
24346     6
24345     6
24345     1

tried using store_id NOT IN (0,1,6) or store_id<>0 And store_id<>1 AND store_id<>6 but seeem not working

>Solution :

Try:

select * 
from my_tbl 
where valueid not in (select valueid 
                     from  my_tbl 
                     where store_id=0);

Demo: https://www.db-fiddle.com/f/4raGrSSZtagsBMDereNzTa/0

Result:

valueid   store_id
24346      6
24345      6
24345      1
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading