Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2007
    Posts
    64

    Thumbs down Unanswered: Displaying column values in a row

    Hi Friends ,

    I have a requirement to display all values of a particular column in a row(like column names) .

    i.e

    i j k-------------columns
    -- -- --
    1 'a' 'aa'
    2 'b' 'bbb'
    3 'c' 'ccc'

    now i need a query that shows the below out put..i.e displaying all the values of the column j horizantaly (in a row)

    'a' 'b' 'c'

    Thanks ,
    Sush

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Quote Originally Posted by sushma007
    Hi Friends ,

    I have a requirement to display all values of a particular column in a row(like column names) ...
    I looked at your other posts to see what type of server you were using but was surprised to see you are posting queries on Oracle, MySQL, Postgre SQL, SQL Server, MySQL and DB2! What do you use in real life? why are you posting questions on so many different server types? Would it be worth getting a bit more experience with SQL before moving so rapidly between server types? Do you realise you've missed out posting queries on the Sybase forum?

    Mike

  3. #3
    Join Date
    Feb 2008
    Location
    Bandung - Indonesia
    Posts
    15
    SELECT j FROM your table name
    Forum Informatika - Indonesian Informatics Online Community - http://if.web.id

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by galih
    SELECT j FROM your table name
    bzzzt, wrong -- this produces values vertically

    your solution is horizontally challenged

    sush, look up GROUP_CONCAT in da manual, it will likely do what you need

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    but Rudy that will only work on MySQL! what about all the other servers sush is working with such as Oracle, Postgre SQL, SQL Server and DB2 - is there no solution to all his problems?

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no idea, mike, i was just answering the question that was asked in the forum that it was asked in

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by mike_bike_kite
    is there no solution to all his problems?
    ...money?
    George
    Home | Blog

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by georgev
    ...money?
    no solution to his problems...
    try alcohol.....

    as Rab C Nesbit will testify alcohol helps the world pass by
    I'd rather be riding on the Tiger 800 or the Norton

  9. #9
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Quote Originally Posted by r937
    no idea, mike, i was just answering the question that was asked in the forum that it was asked in

    Ahhh yes, that does give the game away a little bit. I'd so much fun following all his other posts in all the other forums that I just assumed (wrongly) he'd posted under database design

Posting Permissions

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