mysql - Joining Tables with duplicate rows as attributes -
i have question concerning mysql, have 2 tables:
data
:
id .. | name .. | job...| 001 | name1. | job1 | 002 | name2. | job2 | 003 | name3. | job3 |
dataattributes
:
id... | number | 001 | value 1 .| 001 | value 2 .| 002 | value 3 .| 003 | value 4 .| 003 | value 5 .|
i want join these tables in way have:
id .. | name.. | job ..|number 1 | number 2..| 001 | name1 | job1 |value 1......| value 2 ..| 002 | name2 | job2 |value 3......|...........| 003 | name3 | job3 | value 4.... | value 5 ..|
can please give me ?
=======solved=======
i have found solution myself using following query
select d.*, (select da.number dataattributes da d.id = da.id limit 1,1) number1, (select da.number dataattributes da d.id = da.id limit 2,1) number2, (select da.number dataattributes da d.id = da.id limit x,1) numberx data d
try this
select * data inner join dataattributes on data.id = dataattributes.id;
Comments
Post a Comment