> <CFQUERY NAME="Products" DATASOURCE="shopping">
> SELECT      Products.ProductTitle, Products.CategoryID,
> Products.ProductID
> FROM        Products, Category
> WHERE       Products.CategoryID = #URL.CategoryID#
> </CFQUERY>
...
> OK there is a big problem with this, it wants to output 2
> times, so if there is just one product to return say "Paper",
> it will return this value twice, is there an error in my code???

Yes, there's a slight problem. In your query, you're using two tables, but
there's no join between them. This is called a Cartesian product, or a cross
join, and is a resultset which contains a number of records equal to the
number in the first table multiplied by the number in the second table. In
any case, you probably want to add an AND clause:

AND Products.CategoryID = Category.CategoryID

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to