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

Get list of items if they match a list into another table

I have these 2 tables which store data:

create table exchanges
(
    exchange_long_name  text,
    exchange_id         bigint
);

create table active_pairs
(
    exchange_id           integer
);

I would like to get the list of exchanges if they are present/match the exchange_id into table active_pairs. How this can be implemented using JOIN?

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

>Solution :

select  distinct exchanges.exchange_id, exchanges.exchange_long_name
from exchanges inner join active_pairs
on exchanges.exchange_id = active_pairs.exchange_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