How to construct a SQL query. I have 2 tables
Table1
Col1 col2 col3
A B 5
A B 5
Table2
Col1 col2 col3 col4 other columns...
A B 5 A1
A B 6 A1
A B 5 A2
A B 5 A2
A B 7 A3
A B 5 A3
.....
.....
I want to select all rows from table 2 which equal the values of table 1, however the rows should be selected only if they have the same value in col4. A query with table1.col1 = table2.col1 and table1.col2=table2.col2 and table1.col3 = table2.col3 will give the results
A B 5 A1
A B 6 A1
A B 5 A2
A B 5 A3
However what I require are only the first 2 rows since only these 2 rows have the same value in column 4('A1')
thanks in advance
Table1
Col1 col2 col3
A B 5
A B 5
Table2
Col1 col2 col3 col4 other columns...
A B 5 A1
A B 6 A1
A B 5 A2
A B 5 A2
A B 7 A3
A B 5 A3
.....
.....
I want to select all rows from table 2 which equal the values of table 1, however the rows should be selected only if they have the same value in col4. A query with table1.col1 = table2.col1 and table1.col2=table2.col2 and table1.col3 = table2.col3 will give the results
A B 5 A1
A B 6 A1
A B 5 A2
A B 5 A3
However what I require are only the first 2 rows since only these 2 rows have the same value in column 4('A1')
thanks in advance