Hi all,
here is my problem: I have two tables, one containing dates and the other dates + data which I'd like to join to get Null rows when no data is found. I would like to get a recordset holding tha values based upon their Id using a left join to fill with NULL when data is missing. I tried with the query below, but I cannot get the Null record showing up. It works without the WHERE clause, but then I'll get all the rows. Any suggestions would be greatly appreciated!
Thank you very much !
Table master
'Fulldate'
'2004-08-10 08:00:00'
'2004-08-10 07:00:00'
'2004-08-10 06:00:00'
Table cab_a
'Fulldate','Id','MeanValue'
'2004-08-10 08:00:00','4','0.9'
'2004-08-10 08:00:00','3','0.5'
'2004-08-10 08:00:00','2','0.01'
'2004-08-10 08:00:00','1','0.14'
............. missing ................
'2004-08-10 06:00:00','4','0.2'
'2004-08-10 06:00:00','3','0.2'
'2004-08-10 06:00:00','2','0.02'
'2004-08-10 06:00:00','1','0.14'
SQL query
SELECT master.Fulldate, MeanValue FROM master left join cab_a using (Fulldate) WHERE id=3 ORDER BY Fulldate DESC;
'2004-08-10 06:00:00','0.2'
'2004-08-10 08:00:00','0.5'
' The recordset I would like to get
'2004-08-10 06:00:00','0.2'
'2004-08-10 07:00:00','NULL'
'2004-08-10 08:00:00','0.5'
Regards,
Paolo Saudin