Results 1 to 12 of 12
  1. #1
    Join Date
    Aug 2009
    Posts
    55

    Unanswered: combine sql output in one row

    Hi,
    If I have below two sql statment.
    select count(*) from table_a;
    select count(*) from table_b;

    How can I output it in one row together
    like below

    Table_a | Table_b|
    10 | 20|


    Please give me detailed example ....

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    post solution from last night's homework assignment
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2009
    Posts
    55
    Quote Originally Posted by anacedent View Post
    post solution from last night's homework assignment
    what is it ???
    any example ???

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    http://www.dbforums.com/oracle/16593...-statment.html

    post completed solution for this thread
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Aug 2009
    Posts
    55
    Quote Originally Posted by anacedent View Post
    http://www.dbforums.com/oracle/16593...-statment.html

    post completed solution for this thread
    No it is not work.
    It is different question .
    I need to output the result in the same row .....
    Union can only post it in the same column ...

    Any other detailed solution /example ..

  6. #6
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >It is different question
    Yes, different question.
    If you are unwilling to share solution for previous question, then why should I share solution here?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  7. #7
    Join Date
    Aug 2009
    Posts
    55
    Quote Originally Posted by anacedent View Post
    >It is different question
    Yes, different question.
    If you are unwilling to share solution for previous question, then why should I share solution here?
    I do not understand what you talk about ...

    Any others know how to pack the output in the same row by sql statement ????
    Union can only pack it in the same column ........

  8. #8
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    select Table_a , Table_b
    from (SELECT ....). (SELECT ...)

    Why do you refuse to post solution to previous thread?
    Last edited by anacedent; 08-14-10 at 01:38.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  9. #9
    Join Date
    Aug 2009
    Posts
    55
    Quote Originally Posted by anacedent View Post
    select Table_a , Table_b
    from (SELECT ....). (SELECT ...)

    Why do you refuse to post solution to previous thread?
    the suggested SQL statement is not work....
    Any other working solution ...

  10. #10
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Why do you refuse to post solution to previous thread?
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  11. #11
    Join Date
    Aug 2010
    Posts
    7
    Whatever anacedent is the right way to get results of two queries in row. You should be using a comma instead of FULL STOP in between those two selects.

    Try this way:

    select a.cnt, b.cnt
    from
    (select count(*) cnt from table_a) a,
    (select count(*) cnt from table_b) b

  12. #12
    Join Date
    Aug 2009
    Posts
    55
    Quote Originally Posted by anacedent View Post
    Why do you refuse to post solution to previous thread?
    I do not quite understand your solution in previous thread ...
    Please give m more detailed example in SQL statment ......

Posting Permissions

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