Ask a Question related to Coldfusion Database Access, Design and Development.
-
rmorgan #1
multiple queries and cfgrid
Hi,
I have a soccer(futbol, for some of you folks) standings page. I have it all
working perfectly within a standard html page just fine. I want to change it
over to a cfgrid. The problem is, I have multiple queries, and it seems as if
cfgrid can only handle one query. I have 2 main queries and about 13 different
subqueries that I would like to combine into one so that I can use cfgrid. I
wont bore you with every single query but if I can be pointed in the right
direction, I am sure I can figure the rest out.
First main query:
<cfquery name="getteams" datasource="#ds#">
SELECT teamname
FROM teams
WHERE age_id = '#ageid#'
group BY team_id
</cfquery>
Second main Query:
<cfquery datasource="#ds#" name="getscores">
SELECT home, homescore, visitor, visitorscore, homeforfeit, visitorforfeit
FROM schedule
WHERE age_id = '#ageid#'
AND (home = '#getteams.teamname#'
OR visitor = '#getteams.teamname#')
</cfquery>
First QofQ:
<cfquery name="gethwins" dbtype="query">
SELECT home
FROM getscores
WHERE homescore > visitorscore
AND home = '#getteams.teamname#'
</cfquery>
Second QofQ:
<cfquery name="gethloss" dbtype="query">
SELECT homescore
FROM getscores
WHERE homescore < visitorscore
AND home = '#getteams.teamname#'
</cfquery>
Third QofQ:
<cfquery name="gethgf" dbtype="query">
select sum(homescore) as hgf
from getscores
where home = '#getteams.teamname#'
and homescore is not null
</cfquery>
Like I said there are several other QofQ's, but this is the jist of it. Can
someone help me out on what I need to do combine these into one query so that I
can use cfgrid? TIA.
rmorgan Guest
-
CFGRID and Multiple CFSELECTS
I am modifying the address book similar to the one shown http://www.asfusion.com/blog/examples/cfdj/ execpt that I have 2 dropdowns: Grade and... -
Cfgrid multiple tables
I have a cfgrid with 3 columns, employee_ID, employee_Name, employee_level. I keep employee_level_ID in the employee talbe and map it to the... -
Multiple DSN queries
I can easily query multiple DSNs in the same CF query, using CFMX 6.1 and win 2000. Unfortunately i am unable to perform the same query on a win2003... -
CF Multiple Queries, Multiple Records
All, I've got three queries all passing variables from previous queries. The issues? The second query returns 4 records. I want to use IDs for... -
posting multiple queries
This is puzzling. If I run $sql = "INSERT INTO customer... -
mxstu #2
Re: multiple queries and cfgrid
You might look into either sql subqueries or using some type of CASE statements
(ie. sql 'case' operator or your database's equivalent). However, a lot
depends on the different levels of information you are trying to display in
your final results and how many tables you are querying. What tables are you
querying (overall)? What information are you retreiving/displaying?
mxstu Guest



Reply With Quote

