DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: SQL spool file

  1. #1
    Join Date
    Jul 2001
    Posts
    334

    SQL spool file

    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.
    Last edited by aph; 10-15-2003 at 02:49 PM.

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Simply use ORDER BY:

    .... ORDER BY invoice_no, tag;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Jul 2001
    Posts
    334
    Thanks for this help.
    Appreciate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width