I've used access primarily before this... I always thought since the
select statement was only requesting data from the members table, then
that would be the only data pulled (ie. 1 record that matched ) ...
apparently not so... but I'm surprised I've never run into this before -


The query you offered below also pulls 4 records

-----Original Message-----
From: Justin D. Scott [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 16, 2005 3:36 PM
To: CF-Talk
Subject: RE: nuts & bolts query ?

> I must be losing it...

Your first query is returning four rows because there are four matching
results from the member_categories table, so it is returning m.company
for
each one of those.  If you only want it to return one record from
members no
matter how many are in member_categories, you need to use a LEFT JOIN
instead of joining by the WHERE clause.

SELECT m.company
FROM members m LEFT JOIN member_categories d
ON m.member_id = d.member_id
WHERE m.member_id = #session.member_id#

Syntax may be a little off, been a while since I wrote a join off the
top of
my head.


-Justin




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206788
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to