I need to select several columns from 2 tables:
Tab1
| Col1 | Col2 | Col3
Tab2
| Col1 | Col4 | Col5
This is my query:
SELECT A.*,B.Col4
FROM Tab1 A,Tab2 B
WHERE A.Col1=B.Col1
AND A.Col2=='XXX'
AND A.Col3>5;
However this query concatenates two tables in some manner and duplicates some rows. What is wrong with it?
The expected result is this one:
Tab3
| Col1 | Col2 | Col3 | Col4
There is no problem with the query you posted, but if the problem is that there are
As you described then use
DISTINCT:Or the other
JOINsyntax: