Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Change from 1 column to 2

    Not sure where to post this, so any direction would be greatly appreciated.

    I have a query that returns two data sets.
    select count (*) from pfvcfnh where vcfabr = 'AUDIT' and vcsta1 = 'A' and vcshdt > 20090101 and vcshdt < 20090617 union
    select count (*) from pfvcfnh where vcfabr = 'AUDIT' and vcsta1 = '01' and vcshdt > 20090101 and vcshdt < 20090617;

    The result looks like this.

    00001
    9479
    19254

    00001 is the column heading
    9479 & 19245 are data.

    How can I rewrite the query so the output is in 2 columns?

    Example
    00001 00002
    9478 19254

    Sorry for such a newbie question.

  2. #2
    Join Date
    May 2009
    Posts
    508
    jblobner, since you posted this is a generic forum, we need information about what database and the version (and the operating system wouldn't hurt) you are using to know how best to answer your question.

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Code:
    SELECT (select count (*) from pfvcfnh where vcfabr = 'AUDIT' and vcsta1 = 'A' and vcshdt > 20090101 and vcshdt < 20090617) As "00001"
         , (select count (*) from pfvcfnh where vcfabr = 'AUDIT' and vcsta1 = '01' and vcshdt > 20090101 and vcshdt < 20090617) As "00002"
    George
    Home | Blog

Posting Permissions

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