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

mysql of searching where without any data by foreign key

i have a problem of searching data .

A table

A_id name  
1    apple 
2    orange
3     sexy

B table

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

B_id A_id comment 
1      1         abcde

how can i get the a_id were without any comment in b table

i want the sql return

a_id name 
2 orange 
3 sexy

>Solution :

SQLs NOT EXISTS operator is for that purpose:

select a_id, name
from A as AT
where not exists 
     (select *
      from B as BT
      where BT.a_id=AT.a_id)
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