Skip to main content
Participant
March 13, 2007
Question

can you combine 2 queries?

  • March 13, 2007
  • 1 reply
  • 266 views
Confusing, I know!
Here's my SQL:
SELECT dbo.Samples.sampleID, dbo.Samples.name, dbo.Samples.category, dbo.Samples.jpegPath, dbo.Samples.thumbs
FROM dbo.Samples
WHERE dbo.Samples.sampleID = '#URL.EID#'

I'm successfully getting the result I'm looking for. HOWEVER, I would also like to get all the items that have the same dbo.Samples.category as the URL.EID item.

Is this possible?


Thanks!
This topic has been closed for replies.

1 reply

Inspiring
March 13, 2007
If that was all you wanted

select fields
from samples
where category in
(select category from samples
where sampleID = '#url.eid#' )

but, since you have already run one query, you can replace the subquery with a quotedvaluelist from that query. Details are in the cfml reference manual. If you don't have one, the internet does.