this about printing a formatted list of room registrations from DDI.LEDGER_VIEW
ID: 3663687 • Letter: T
Question
this about printing a formatted list of room registrations from DDI.LEDGER_VIEW - I am a bit confused on how this would work. I know how to SPOOL my output to the appropriate file. Now when it come to formanting the COLUMN Headings and formating the ROOMNUM, REGDATE, LASTNAME, ADULTCNT, CHILDCNT would I simply write:
SQL> SET ECHO ON
SQL> SPOOL c:cd 485solution.txt
SQL> START c:cd485soultion.txt (where does the DDI.LEDGER_VIEW come in??)
SQL> COLUMN ROOMNUM HEADING ROOMNUM FORMAT 999999999
SQL> COLUMN REGDATE HEADING ARRIVAL DATE FORMAT DATE
SQL> COLUMN LASTNAME HEADING CUSTOMER NAME FORMAT A16
SQL> COLUMN ADULTCNT HEADING ADULTCNT FORMAT 99999
SQL> COLUMN CHILDCNT HEADING CHILDCNT FORMAT 9999
but how do I do the ROOMRATE BREAK on ROOMNUM and COMPUTE??? Also I am confussed on how to do the ROOMRATE for each ROOMNUM?????
SELECT the fields indicated above from DDI.LEDGER_VIEW for registrations between '01-JUN-15' and '07-JUN-15' and I need to order it by ROOMNUM and REGDATE
I figured I would write the Break as followed
SQL> BREAK ON ROOMRATE skip one on Roomnum
SQL> COMPUTE SUM LABEL subtotal OF ROOMRATE ON ROOMNUM
SQL> COMPUTE SUM LABEL 'Grand Total' OF ROOMRATE ON ROOMNUM
SQL> SELECT REGDATE <'01-JUN-15&07-JUN-15>
2 FROM DDI.LEDGER_VIEW
3 ORDER BY ROOMNUM, REGDATE
4 /
Would this be correct???? Any help would be appriciated it!!! Thank you
Explanation / Answer
The queries are absolutely correct logically and syntactically. The break and Compute are correctly done in the query below.
SQL> BREAK ON ROOMRATE skip one on Roomnum
SQL> COMPUTE SUM LABEL subtotal OF ROOMRATE ON ROOMNUM
SQL> COMPUTE SUM LABEL 'Grand Total' OF ROOMRATE ON ROOMNUM
SQL> SELECT REGDATE <'01-JUN-15&07-JUN-15>
2 FROM DDI.LEDGER_VIEW
3 ORDER BY ROOMNUM, REGDATE
4 /
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.