If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How to combine multiple rows into one with same value

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-07-10, 23:37
catherinerodil catherinerodil is offline
Registered User
 
Join Date: Nov 2010
Posts: 1
Cool 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!
Reply With Quote
  #2 (permalink)  
Old 11-08-10, 04:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
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?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On