Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    1

    Cool Unanswered: How to combine multiple rows into one with same value

    Hi guys,

    Please help me with this one.:

    here's my query:
    SELECT DISTINCT a.[Column3], b.[Column4], c.[Column5]
    FROM [Table1] a
    INNER JOIN [Table2] b ON a.[Column1] = b.[Column1]
    INNER JOIN [Table3] c ON b.[Column2] = c.[Column2]
    WHERE a.[Column1] = 147

    and here's the result:
    Column3 Column4 Column5
    PD CS data1
    PD CS data2
    PD ST data3
    PD ST data4
    SM DE data5
    SM DI data6
    SM DI data7
    SM SR data8
    SM SR data9

    it should be like this:
    Column3 Column4 Column5
    PD CS data1
    data2
    ST data3
    data4
    SM DE data5
    DI data6
    data7
    SR data8
    data9

    please help me.. thanks in advance!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you mean like this, right?
    Code:
    Column3	Column4	Column5
    PD	CS	data1
    		data2
    	ST	data3
    		data4
    SM	DE	data5
    	DI	data6
    		data7
    	SR	data8
    		data9
    this is not done with SQL

    this is done by whatever application language is receiving the results of the query

    oh, and by the way, mysql does not support those dinky square brackets

    perhaps you meant to post in the microsoft sqlserver forum?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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