How to select all records from the left table and all the records on the 
right that match certain criteria.

This does not work because the where clause filters out all the 'NULLS' 
from the records in the a table that do not have a matching record in 
the b tables.

SELECT
   a.field,
   count(b.field)

FROM
   aTable a LEFT OUTER JOIN bTable b
      ON a.key = b.fkey

WHERE
   b.year BETWEEN 2000 AND 2003 AND
   b.type = 'C'

GROUP BY
    a.field

What is the best work around for this?  Do I just provide a big 'OR' 
clause to the WHERE statements that also allows for nulls for year and 
type?  Or is there a more elegant solution to this problem?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314818
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to