Click to See Complete Forum and Search --> : SQL spool file


aph
10-15-2003, 02:46 PM
Hi,
Please consider that I have a table 'INV' with the following columns.

Table rows
INVOIVE_NO DESCRIPTION AMOUNT TAG
1000 Tax 15.00 2
1000 Beer 200.00 1
2000 Soda 100.00 1
2000 Tax 10.00 2
3000 Cofee 500.00 2
3000 Tax 30.00 1

I want spool file in a sequence like for each invoice line, it create first TAG 1(beer)line and then TAG 2(Tax)line always.

* Need output (12, 12, 12 .......) first tag 1 then tag 2
* Please check the below output.

spool file output
1000 Beer 200.00 1
1000 Tax 15.00 2
2000 Soda 100.00 1
2000 Tax 10.00 2
3000 Tax 30.00 1
3000 Cofee 500.00 2

Thanks in advance.

jmodic
10-15-2003, 02:58 PM
Simply use ORDER BY:

.... ORDER BY invoice_no, tag;

aph
10-15-2003, 03:19 PM
Thanks for this help.
Appreciate.