I can't figure out why Table A is returning null value after I left join with Table B. It should be 3 tables but for now, i'm just getting the two tables to work.
Table A
IUEID DATE MONTH DATAA
4444 01 JAN 150
4444 02 JAN 98
4444 03 JAN 78
4444 04 JAN 55
TABLE B
IUEID DATE MONTH DATAB
4444 02 JAN CORN
4444 03 JAN GRAPES
SELECT *, TABLEB.DATAB
FROM TABLEA
LEFT JOIN TABLEB
ON TABLEB.IUEID = TABLEA.IUEID
AND TABLEB.DATE = TABLEA.DATE
GROUP BY TABLEA.DATE
OUTPUT:
IUEUD DATE DATAA DATAB
(empty) (empty) 150 (emtpy)
4444 02 98 CORN
4444 03 78 GRAPES
(empty) (empty) 55 (empty)
*usetableA.*or better spell out each column explicitly; the engine could be getting confused about which column to display since names are the same in both tables. Provide a sqlfiddle.com or rextester.com working example showing the problem; but I bet the * or the group by is causing the issue. in mysql*totableA.*mySQL can be quirky when you have tables with the same column name! Other RDBMS would indicate an error as they wouldn't be able to resolve which table column you mean; mysql assumes they are equal and picks one. (much more complex than this but general gist)