Home » SQL & PL/SQL » SQL & PL/SQL » sql report creation
sql report creation [message #214510] Tue, 16 January 2007 17:22 Go to next message
chris81
Messages: 4
Registered: January 2007
Junior Member
Hi Everyone:

I trying to generate a report in sql plus work sheet to show the cars sold before a certain date and the total amount sold. This is the code I've written so far-

COLUMN Car_Num FORMAT 099 HEADING 'Car Count'
COLUMN CarReg FORMAT 099 HEADING 'Car Registration'
COLUMN Make FORMAT A9 HEADING 'Make' JUSTIFY LEFT
COLUMN Model FORMAT 9999 HEADING 'Model'
COLUMN HireRate FORMAT 99,999.99 HEADING 'Hire Rate'
COLUMN DatePurchased FORMAT 99,999.99 HEADING 'Purchase Date'

Select * from car
Where DatePurchased < '01-JAN-05'

Select Count(Model) Car_Num from car
Where DatePurchased < '01-JAN-05';

Each query runs fine but each query is outputted on a seperate page is there anyway I can out put the number of cars query result at the bottom of the table generated by the first query.

Any Help would be appreciated
Re: sql report creation [message #214550 is a reply to message #214510] Wed, 17 January 2007 00:08 Go to previous messageGo to next message
akshayag_krishna
Messages: 2
Registered: January 2007
Location: xxx
Junior Member

HELLO,
I JUST SAW THAT QUERY,AND I DIDNT REFER ANY BOOKS BUT I HAVE ONE IDEA,U CAN TRY WETHER IT IS CORRECT OR NOT THAT IS
FIRST V HAV 2 START BY SETTING ENVIRONMENT CONDITIONS AND THEN INCLUDE THE BELOW 2 LINES GIVEN;

COMPUTE COUNT OF MODEL ON REPORT
BREAK ON REPORT

























Re: sql report creation [message #214673 is a reply to message #214510] Wed, 17 January 2007 07:50 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
chris81 wrote on Tue, 16 January 2007 18:22
Hi
Select * from car
Where DatePurchased < '01-JAN-05'

Select Count(Model) Car_Num from car
Where DatePurchased < '01-JAN-05';



Since you are new, why not start out by coding correctly before it becomes too ingrown into your thinking making it more difficult to switch later.
You are comparing a DATE column to a character string. You are asking for trouble. I guarantee, those queries will fail on many many systems.
Re: sql report creation [message #214679 is a reply to message #214673] Wed, 17 January 2007 08:27 Go to previous messageGo to next message
ab_trivedi
Messages: 460
Registered: August 2006
Location: Pune, India
Senior Member
hi chris,

don't compare date field with the charecter string.

what does it mean :
Quote:
COLUMN DatePurchased FORMAT 99,999.99 HEADING 'Purchase Date'


Ashu
icon7.gif  Re: sql report creation [message #214681 is a reply to message #214510] Wed, 17 January 2007 08:39 Go to previous message
chris81
Messages: 4
Registered: January 2007
Junior Member
Thanks to everyone who replied your suggestions, gave me the clues I needed to solve my problem.

Thank You.
Previous Topic: Merging two flat files
Next Topic: Updating and Deleting from collections
Goto Forum:
  


Current Time: Mon Dec 05 13:05:54 CST 2016

Total time taken to generate the page: 0.06169 seconds