Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2010
    Posts
    3

    Unanswered: unload data of two items to one file

    Hi
    i want to use the unload command to unload data of two or more items,but the data must go to one file.How can i do this.

    sample that i use:
    unload to b.txt select * from table where item='pea';
    unload to b.txt select * from table where item='corn';
    i need both outputs in the b.txt file.
    But what happens is that the second one overwrites the first one.

    Please help

  2. #2
    Join Date
    Dec 2003
    Location
    North America
    Posts
    146

    AIX / UNIX solution

    I'd unload data to a.txt and b.txt then append the contents of one file to another

    cat a.txt >> b.txt

  3. #3
    Join Date
    Jul 2009
    Posts
    37
    Alternatively, just union the 2 queries together...

    unload to b.txt
    select * from table where item='pea'
    union all
    select * from table where item='corn';

  4. #4
    Join Date
    Dec 2003
    Location
    North America
    Posts
    146
    Another method would be

    unload to b.txt select * from table where item in ('pea','corn');

  5. #5
    Join Date
    Apr 2010
    Posts
    3
    Thank you for the response, but i have a limitation when i use this option,i can't use it to unload more than 6,000 records. i need a method that can unload about 100,000 records.

Posting Permissions

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