<cfquery datasource="mydb" name="TheName">
SELECT *
FROM contacts,image_list,coupons
WHERE contacts.contact_id = image_list.contact_id
AND     contacts.contact_id = coupons.contact_id
</cfquery>


To expand on the previous response, here are a couple of ways to do outer joins.

You can do the joins in the where clause, as your example does with outer join 
characters, but I understand these are DBMS specific.  For the Oracle systems I 
use at work I would code your query like such.

<cfquery datasource="mydb" name="TheName">
SELECT *
FROM contacts,image_list,coupons
WHERE contacts.contact_id = image_list.contact_id(+)
AND     contacts.contact_id = coupons.contact_id(+)
</cfquery>

The (+) beside the fields that can have 0 or more matches does what you want.

You can also do the joins in the where clause.  Then your quiry would look 
something like this.

<cfquery datasource="mydb" name="TheName">
SELECT *
FROM contacts 
LEFT JOIN image_list ON contacts.contact_id = image_list.contact_id,coupons
LEFT JOIN Coupons ON contacts.contact_id = coupons.contact_id
</cfquery>


None of this syntax is tested so errors may exist, but HTH.

--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

"C code. C code run. Run code run. Please!"
- Cynthia Dunning



Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185460
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to