Hi,

Depending n the number of rows returned from this 'complicated' query, this 
approach may or may not work.

I am unsure as to which database you are using but each differs in the number 
of values it can cope with in an IN clause.

Lets assume its 1000 values ( or probably closer to 2000). You may wish to 
limit the number or rows passed to the IN clause.

You may care to use: ( an aggregate type query I think its called, but dont 
quote me)

SELECT
FROM
    (  really big and very complicated query  ) AS selected_orders INNER JOIN
   SALESDETAIL sd ON
    SOMETABLE .SalesHDRID = selected_orders.SalesHDRID 

a more robust approach I think.

Cheers,



>>> "Steve Onnis" <[EMAIL PROTECTED]> 12/11/2008 9:46 am >>>

 SELECT salesdetail.packerid
       FROM SALESDETAIL
       WHERE SALESDETAIL.SalesHDRID IN
(#ValueList(SelectedOrders.SalesHDRID)#)

That will output all the items returned from that column into your query

-----Original Message-----
From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Khush
Sent: Wednesday, 12 November 2008 9:02 AM
To: cfaussie
Subject: [cfaussie] Referencing a query inside another query in ColdFusionMX


How do i reference a field (SalesHDRID) from a query (called
SelectedOrders) in the where condition of another query.

My CF query looks somewhat like this-
SELECT salesdetail.packerid
       FROM SALESDETAIL
       WHERE SALESDETAIL.SalesHDRID IN (SelectedOrders.SalesHDRID)

Now my query SelectedOrders is a really big and very complicated one,
so I am not going to just paste it in the IN clause...If anyone has
any ideas how to actually reference this sub query by it;s name in the
main query above, please let me know ASAP as i need this urgently...


THanks






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to