I figured it out... thanks Jeff for the tip

-----Original Message-----
From: Jeff Langevin [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 16, 2005 4:39 PM
To: CF-Talk
Subject: Re: nuts & bolts query ?

The first query creates an inner join between the two tables.  Try 
dumping them into query analyzer and take a look at the execution plan. 
  It'll give you a better idea of what its doing with your queries.

--Jeff


On 5/16/2005 3:45 PM, Tim Laureska wrote:

> I must be losing it....Why do these two queries return different sets
of
> results when we're only selecting records from one table (there is
only
> one company in the members table with a member_id equal to the
> session.member_id value of 13 (using sql server 2000):
> 
> 1) THIS YIIELDS AN OUTPUT OF 4 RECORDS
> <cfquery datasource="#master_db#" name="test">
> Select m.company
> FROM members m, member_categories d
> where m.member_id=#session.member_id# AND m.member_id=d.member_id
> </cfquery>
> 
> <cfoutput query="test">#company#</cfoutput>
> 
> 2) THIS YIIELDS AN OUTPUT OF 1 RECORD
> <cfquery datasource="#master_db#" name="test">
> Select m.company
> FROM members m
> where m.member_id=#session.member_id#
> </cfquery>
> 
> <cfoutput query="test">#company#</cfoutput>
> 
> The table data looks like this:
> 
> MEMBERS table:
> 1 record with the primary key being "member_id" - one record with a
> member id of "13"
> 
> MEMBER_CATEGORIES table:
> A foreign key field called "member_id" with 4 records having a
member_id
> of "13"
> 
> 
> 
> 
> 
> 
> 
> Tim
> 
> 
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:206801
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