Hello Friends,
The main problem is that MySQL LEFT JOIN is no working. It is giving the output same as NORMAL JOIN !!
Example -
Table TB1 -
OUTPUT:
I should Give -
But giving -
Whats wrong I am doing ??!!
The main problem is that MySQL LEFT JOIN is no working. It is giving the output same as NORMAL JOIN !!
Example -
Table TB1 -
Table TB2 -ID NAME
------------------------------
1 AAAA
2 BBBB
Normal JOIN:ID SUBJECT
---------------------------------
1 MATH
1 CHEM
2 MATH
2 PHYS
Code:
SELECT tb1.name,tb2.subject FROM tb1,tb2 WHERE tb1.id=tb2.id AND tb2.subject='CHEM';
Now using LEFT JOIN:AAAA CHEM
Code:
SELECT tb1.name,tb2.subject FROM tb1 LEFT JOIN tb2 ON tb1.id=tb2.id WHERE tb2.subject='CHEM';
I should Give -
AAAA CHEM
BBBB NULL
But giving -
AAAA CHEM
Whats wrong I am doing ??!!