Skip to content
Advertisement

How can I query the list of IDs with conditions on couple of fields?

I have the following two tables:

Table A

Table B

I need to get the IDs from Table A that have values of Code1, Code2 equal to values of Code1,Code2 from table B?

I need to get the following result.

Advertisement

Answer

You can try this using exists as shown below.

Here is the live db<>fiddle demo. It looks as shown in the below image.

enter image description here

Another way is to use the SQL JOIN and different types of JOINs .

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement