Ouch.
This is not something you want to do...
Query results should be joined using the UNION operator in SQL. Many
people
don't realize that you can hard-code query columns to aid in this
effort
like so...
SELECT appID, appName, '1' AS isOnline
FROM apps
WHERE whatever IS NOT NULL
UNION
SELECT appID, appName, '0' AS isOnline
FROM apps
WHERE whatever IS NULL
It looks almost like you are trying to query for total online apps and
total
offline apps (per owner?) in this instance however...
SELECT count(*) AS appCount, appOwner, isOnline
FROM apps
GROUP BY appOwner, isOnline
ORDER BY appOwner, isOnline
You will end up with a query like this...
appOwner isOnline appCount
-----------------------------------------
1 0 15
1 1 22
2 0 4
2 1 13
etc.....
You can output the results like so...
<cfoutput query="myquery" startrow="2" group="appOwner">
#appOwner# - offline:#myquery.appCount[currentrow-1]# -
online:#appCount#<br>
There are other ways to output, but this one is relatively simple. You
could also use a conditional loop or a FOR loop (from 2 to recordcount
step
2).
Anyway, don't use CF to do what the DB does best...
+-----------------------------------------------+
Bryan Love
Macromedia Certified Professional
Internet Application Developer
Database Analyst
Telecommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+
"...'If there must be trouble, let it be in my day, that my child may
have
peace'..."
- Thomas Paine, The American Crisis
-----Original Message-----
From: Tammy Hong [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 09, 2002 11:48 AM
To: CF-Talk
Subject: Problem with QuerySetCell
Hi,
I am trying to add the values from a second query to my first query but
for
some reason it is setting all rows to the first value of the query. Can
someone tell me what I did wrong? TIA.
<CFSET NullArray = ArrayNew(1)>
<CFLOOP INDEX="Row" FROM="1" TO="#qryGetOnlineApps.RecordCount#">
<CFSET NullArray[#Row#] = "0">
</CFLOOP>
<CFSET Dummy =
QueryAddColumn(qryGetOnlineApps,"OfflineApps",NullArray)>
<CFLOOP query="qryGetOnlineApps"> <CFSET Dummy=
QuerySetCell(qryGetOnlineApps,"OfflineApps",qryGetOfflineApps.TotalOffli
neAp
p,qryGetOnlineApps.CurrentRow)>
</CFLOOP>
Tammy
______________________________________________________________________
Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists