Skip to content
Advertisement

Need to extract he rows which have the same column names in common between 2 tables and show only the 2nd table common rows

I have 2 tables.

1st table contain the columns which are:

component ID, item name, item value 

2nd table contains the columns which are:

component ID, biscuits,chocolates

If both the component ID in both tables matches (Ex :component 1 in table1= component 1 in table 2), return all the rows matched with component in table 2.

I am new to SQL and I am finding it difficult to do so.

Advertisement

Answer

You just need to use inner join

select t2.* from table2 t2 inner join table1 t1 on t2.componentId=t1.componentId
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement