Help with SQL query!
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Help with SQL query!

  1. #1
    Join Date
    Feb 2003
    Posts
    4

    Help with SQL query!

    Hope anyone can help me here.
    This is an example situation:

    Table PetOwner

    Peter Cat
    Peter Dog

    This is the table that i want to generate a query from. But i want the query to return results in this order if i wanted to find what pets Peter owned:

    Generated results from SQL query

    Peter Cat Dog

    I.e. Instead of 2 records returned I want a single record returned with all pets associated with Peter returned in columns and not as individual rows.

    Can anyone help this poor chap here?

  2. #2
    Join Date
    May 2002
    Posts
    108

    Cross tab - PL/SQL Cursor

    Guess you want a CROSS TAB report. I don't know if Oracle 9i has incorporated any feature. The best bet for you is to traverse a
    PL/SQL cursor and do it your self as functions can return a value or valueset as you wish !


    Cheers
    Nandu
    Never give up !

    Nanda Kumar - Vellore

  3. #3
    Join Date
    Feb 2003
    Posts
    4
    Thanks for the reply.
    I can achieve this applying PL/SQL but i was trying to avoid taking that route. If any functions exist within SQL so that just a SQL query can achieve a horizontal resultset would be ideal.

    Thanks.

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