Why not do a join ?

<cfquery name="get_prod_with_variants" datasource="#dsnvar#"
dbtype="#dsntype#">
SELECT * FROM prod p, variants v
WHERE p.cat_id = '1' AND p.active = '1' AND p.prod_id = v.prod_id
ORDER BY p.prod_priority
</cfquery>

Nick

-----Original Message-----
From: Chris Poole [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 06, 2001 10:57 AM
To: CF-Talk
Subject: Multiple Query Problem


To anyone who can help,

I am trying to output a list of records on a page, also nested in this list
are individually populated
drop down boxes which has values determined by the parent record. But before
I get to this stage I can't get the query
syntax right.

I can't quite get the query syntax right, below is what I have tried but I
only seem to get 1 variant and no more.
All the records are there but can't seem to output them. I have also tried
<cfx_dumpquery> tag but still can't get any more than
one row out of get_variants.

<cfquery name="get_prod" datasource="#dsnvar#" dbtype="#dsntype#">
SELECT * FROM prod
WHERE cat_id = '1' AND active = '1'
ORDER BY prod_priority
</cfquery>

<cfquery name="get_variants" datasource="#dsnvar#" dbtype="#dsntype#">
Select *
>From variants
WHERE prod_id = #get_prod.prod_id#
</cfquery>

Am probably being stuuupid due to sleep depravation.

If anyone can help I would appreciate it.

Cheers

Chris.


-------------------------------------------------------
Chris Poole
Development Engineer

-------------------------------------------------------
e-mango.com ltd                      Tel: 01202 587 400
Lansdowne Place                      Fax: 01202 587 401
17 Holdenhurst Road
Bournemouth                   Mailto:[EMAIL PROTECTED]
BH8 8EW, UK                      http://www.e-mango.com
-------------------------------------------------------


**********************************************************************
Information in this email is confidential and may be privileged. 
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system. 
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone. 
Thank you for your co-operation.
**********************************************************************

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to