Advertisement

10.26.2007 at 11:13AM PDT, ID: 22920876
[x]
Attachment Details

Help With Writing SQL Query With ColdFusion

Asked by FSUKXAZ in SQL Query Syntax

Tags: coldfusion, sql, writing, queries

I need help with the second query in the query of queries.  The IN clause is putting the list of categories in one long string instead of seperating them.  I tried the setting a variable and using ListQualify, but that just adds more ' marks.  Since it's a variable that is a always more than one what's the correct way of writing that SQL part?  Techincally you don't need to be a ColdFusion guy to answer this.  I need a DBA.

<CFQUERY NAME="Query1" DataSource="TheDataSource">
SELECT Distinct subcategory, count(subcategory) AS subcategorycount
FROM Categories
WHERE BlahTime > ###OtherTime###
GROUP BY subcategory
</CFQUERY>
<CFSET Yo = #ListQualify(form.EventCategory, "'",",")#>

<CFQUERY NAME="QOQ" DBTYPE="query">
SELECT Distinct subcategory, count(subcategory) AS subcategorycount
FROM Query1
WHERE subcategory IN ('#Yo#')
GROUP BY subcategory
</CFQUERY>Start Free Trial
 
Loading Advertisement...
 
[+][-]10.26.2007 at 01:41PM PDT, ID: 20158870

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.26.2007 at 01:53PM PDT, ID: 20158962

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 06:11AM PDT, ID: 20169117

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 06:18AM PDT, ID: 20169155

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Tags: coldfusion, sql, writing, queries
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 2
Solution Grade: B
 
 
[+][-]10.29.2007 at 08:30AM PDT, ID: 20170287

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628