Simple join gives unnecessary rows,How to get join properly with only matches in both tables
- by LS
Table 1
Field1 Field2
AA 20
AA 20
AB 12
AC 13
Table2
field3 field4
AA 20
AA 20
AC 13
AD 23
AW 21
output required:
newfield field2 field4
AA 20 20
AA 20 20
AC 13 13
I used:
select field1 as newfield, t1.field2,t2.field4
from table1 t1 join table2 t2 on t1.field1=t2.field3
This does not give the required output,Please let me know how to get the required output,Many thx in advance