Query of Query between multiple recordsets

10 views
Skip to first unread message

Steve Onnis

unread,
Aug 22, 2012, 4:05:23 AM8/22/12
to cfau...@googlegroups.com
Does anyone know if you can actually query of query between more than one query?

like

<cfquery dbtype="query" name="LOCAL.searchResults">
    SELECT    column
     FROM    query1, query2
     WHERE    query1.id = query2.id
</cfquery>

I am trying to do it but seem to be getting casting issues.  I have tried to case the datatypes to be the same type but still no joy

Steve

Zac Spitzer

unread,
Aug 22, 2012, 4:13:07 AM8/22/12
to cfau...@googlegroups.com
you definitely can, one workaround for casting issues is to simply
serialise to json and back
> --
> You received this message because you are subscribed to the Google Groups
> "cfaussie" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cfaussie/-/i9vh8frVHKkJ.
> To post to this group, send email to cfau...@googlegroups.com.
> To unsubscribe from this group, send email to
> cfaussie+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cfaussie?hl=en.



--
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
+61 405 847 168

Andrew Myers

unread,
Aug 22, 2012, 4:17:15 AM8/22/12
to cfau...@googlegroups.com
Would using union help? I've done this before with qoq but I'm not sure of its applicable here without seeing your data sets

Sent from my mobile

Steve Onnis

unread,
Aug 22, 2012, 10:20:26 AM8/22/12
to cfau...@googlegroups.com
i am doing a filtering process combining a cfsearch result set and a result
set from a database query. The KEY value from the cfsearch is matching up
with the primary key value from the db query. i did notice that the key
value from cfsearch is cast as a string where was the id from the db is a
number.

i have tried casting both to NUMBER and as STRING but neither worked and
still got the casting error and also the error saying that the query was
"expecting (like|between)" thing when i try to use "=" in the join

Steve Onnis

unread,
Aug 23, 2012, 9:33:31 PM8/23/12
to cfau...@googlegroups.com
Finally got this to work.  It seemes i only needed to CAST the value that was a string and not the one that was already a number.
Reply all
Reply to author
Forward
0 new messages