-- Hi All, post-upgrade I need to re-write some old-style joins from sql2000 (sp3).
-- But query1 (below) returns 225 rows whilst query2 only returns 15. Any help please?
select station,type,count(stn) as No_Inc
from L_LOCATIONS L, L_MAIN_TYPES M, I_DETAILS I
where L.station*=I.stn and M.type*=I.main_type
group by station,type
order by station,type
SELECT L.station, M.type, COUNT(I.stn) AS No_Inc
FROM dbo.L_LOCATIONS AS L
LEFT JOIN dbo.I_DETAILS AS I ON L.station = I.stn
RIGHT JOIN dbo.L_MAIN_TYPES AS M ON I.main_type = M.type
GROUP BY L.station, M.type
ORDER BY L.station, M.type
-- not wanting to paste too much here ... query1_column1 returns 15 'A's then proceeds down the alphabet to row 225.
-- query2_column1 retuns 15 NULLS then stops. The other 2 columns are the same (to line 15 anyways).
-- column2 contains a 4-character codes, repeated 15 times (IE: col2row1=col2row16, col2row3=col2row17 etc etc)
-- column3 is always 0 (zero)