Home » SQL & PL/SQL » SQL & PL/SQL » Join Multiple Statements
Join Multiple Statements [message #9104] Mon, 20 October 2003 01:18 Go to next message
eggohead
Messages: 3
Registered: October 2003
Junior Member
Hello, I have the following code for the 3rd quarter I need to include all 4 quarters in this view. The only thing that will change is the qtr name (ie qt1, qtr2 etc) the sums and the date ranges. How can I join each of these queries for all quarters into one big one that will output each quarter in the view, ive tried but keep getting erros? - thanks for your help
SQL> CREATE VIEW campuscont_qtr3 AS
2 SELECT campus.campus,
3 ROUND(campus.QTR3/tot_contr,2)*q3 "CONTRIBUTION 3RD QTR",
4 (ROUND(campus.QTR3/tot_contr,2)*q3)/
5 campus.QTR3*100 "% OF TARGET ACHIEVED"
6 FROM campus,(SELECT SUM(AMOUNT) Q3
7 FROM contribution wHERE CDATE >= TO_DATE('07/01/03', 'MM/DD/YY')
8 AND CDATE <= TO_DATE('09/30/03', 'MM/DD/YY')) Q3contr,
9 (SELECT SUM(QTR3) Tot_Contr FROM campus) totcontr;

CAMPUS CONTRIBUTION 3RD QTR % OF TARGET ACHIEVED
------ -------------------- --------------------
Main 396.9 79.38
East 194.4 77.76
West 97.2 77.76
North 121.5 81
Re: Join Multiple Statements [message #9109 is a reply to message #9104] Mon, 20 October 2003 03:43 Go to previous message
Gnanam
Messages: 19
Registered: July 2002
Junior Member
u can use union of all the three quarters...
Previous Topic: Is existence of rowid, sequence, index redundant?
Next Topic: URGENT (Parameter-problem)
Goto Forum:
  


Current Time: Tue May 07 03:12:44 CDT 2024