Hi - have the following query that displays site.site in one column followed by target in next column and then dealcount in the last column - this works fine but if dealcount isnull then the site names arent shown - i need this so that a blank table can be shown to add data.
i could do this by creating a 'dummy' table filled with 0
but i would need to execute two queries [one, if RS is EOF] but this seems bad practice - the problem is because the query is FROM deal not site and i dont know how to swap them over
thanks MG
Code:
SELECT site.site, count(CB.dealid) AS dealcount, site.siteid, tarr.target, tarr.targetid
FROM deal AS CB
LEFT JOIN user ON user.userid = CB.userid
LEFT JOIN site ON site.siteid = user.site
LEFT JOIN (SELECT tar.target, tar.siteid, tar.targetid FROM target AS tar ) AS tarr ON tarr.siteid = user.site
WHERE (cb.bookst BETWEEN '20080301' AND '20080631')
GROUP BY site.siteid
ORDER BY site.siteid
i could do this by creating a 'dummy' table filled with 0
but i would need to execute two queries [one, if RS is EOF] but this seems bad practice - the problem is because the query is FROM deal not site and i dont know how to swap them over
thanks MG