Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
wein #1
Query of Queries Combining Results
I have a question related to query of queries and unions/joins. Below are my
two queries and the output from them. What I need to do is join the queries so
that the final output results area as follows. Note that some budget items are
not in the actuals and some actuals are not in the budget. I have been trying
to read over recordsets and wasn't sure if this is what I should use or not. I
have also tried to do unions and cfloops but I'm not able to get the data
outputted in the format needed. I am using coldfusion MX 6. Any help would be
appreciated. Thank you.
Budget
Actual
01 - REGULAR LABOR
100,000
60000
03 - VERA/VSIP
0
25000
05 - TERMINAL LEAVE
0
4500
06 - PCS MOVES
0
500
07 - AWARDS, RETENTION ALLOWANCES, AND RECRUITMENT BONUSES 10000
5000
08 - OVERTIME
5000
2000
09 - MATERIAL AND SUPPLIES
4000
2550
10 - EQUIPMENT
5000
2700
13 - ELECTRIC AND OTHER UTILITIES
-516
-213
14 - POSTAGE
800
200
15 - COMMUNICATIONS
20000
15900
16 - CONTRACTS
20000
5000
17 - PRINTING
15000
4000
19 - TRAVEL AND TRANSPORTATION
16000
10000
20 - OTHER TRAVEL
6145
1019
21 - TRANSPORTATION OF THINGS
27800
575
22 - RENT - OTHER
3900
3900
26 - NON LABOR, FUNDED
-5000
-1
28 - MISC COSTS
20000
0
<cfquery name="FinalBudgetNotInActuals" dbtype="query">
SELECT distinct BEORIDS_DESCRIP, BudgetDollars
from ActualsVsBudget
where BEORIDS_DESCRIP <> EORIDS_DESCRIP
ORDER BY BEORIDS_DESCRIP
</cfquery>
RESULTS FROM ABOVE QUERY
01 - REGULAR LABOR
100,000
07 - AWARDS, RETENTION ALLOWANCES, AND RECRUITMENT BONUSES 10000
08 - OVERTIME
5000
09 - MATERIAL AND SUPPLIES
4000
10 - EQUIPMENT
5000
13 - ELECTRIC AND OTHER UTILITIES
-516
14 - POSTAGE
800
15 - COMMUNICATIONS
20000
16 - CONTRACTS
20000
17 - PRINTING
15000
19 - TRAVEL AND TRANSPORTATION
16000
20 - OTHER TRAVEL
6145
21 - TRANSPORTATION OF THINGS
27800
22 - RENT - OTHER
3900
26 - NON LABOR, FUNDED
-5000
28 - MISC COSTS
20000
<cfquery name="FinalActualsNotInBudget" dbtype="query">
SELECT distinct EORIDS_DESCRIP, ActualDollars
from ActualsVsBudget
where EORIDS_DESCRIP <> BEORIDS_DESCRIP
ORDER BY EORIDS_DESCRIP
</cfquery>
RESULTS FROM ABOVE QUERY
01 - REGULAR LABOR
60000
03 - VERA/VSIP
25000
05 - TERMINAL LEAVE
4500
06 - PCS MOVES
500
07 - AWARDS, RETENTION ALLOWANCES, AND RECRUITMENT BONUSES 5000
08 - OVERTIME
2000
09 - MATERIAL AND SUPPLIES
2550
10 - EQUIPMENT
2700
13 - ELECTRIC AND OTHER UTILITIES
-213
14 - POSTAGE
200
15 - COMMUNICATIONS
15900
16 - CONTRACTS
5000
17 - PRINTING
4000
19 - TRAVEL AND TRANSPORTATION
10000
20 - OTHER TRAVEL
1019
21 - TRANSPORTATION OF THINGS
575
22 - RENT - OTHER
3900
26 - NON LABOR, FUNDED
-1
28 - MISC COSTS
0
wein Guest
-
Query of Queries - Combining Two Datasources
Problem: Query needs to combine fields from one datasource with those of another, matching on a common ID. Example: <CFQUERY... -
Complex join = no results (for a query that shouldreturn results)
I am trying to use a rather complex join that returns many results when the SQL server is queried directly, but returns no results when used on a... -
Combining Verity with Query of Queries
Verity is capable of very powerful text searches and indexing, but it only returns Key, title, and decription. I'm working on an e-commerce site... -
Query results don't display properly in results table.IGNORE PREVIOUS
:disgust; I need to display the results of a query. The query runs properly. My problem is having specific results display in specific locations in... -
Query results don't display properly in results table.
:disgust; I need to display the results of a query. The query runs properly. My problem is having specific results display in specific locations in...



Reply With Quote

