mysql - SQL - Adding multiple values in 1 column -
i want add multiple values of join query in 1 single column. there way that?
here fiddle: http://sqlfiddle.com/#!9/90540/1
here screen of how result should http://i60.tinypic.com/5pk7yg.png "result"
ok here problem, (and many people here, believe) doesn't have clue what's point of query, goal want achieve this.
to desired result can this...
select case when p.id = 1 p.id end col1, case when p.id = 1 p.`value` end col2, case when p.id = 1 (select id site_gender id = 2) end col3, case when p.id = 1 (select `value` site_gender id = 2) end col4, a.id, a.email site_gender p join user_account on p.id = a.id
but query doesn't have sense, you'll desired result don't know can else it.
here fiddle see what's happend there...
but if change little table site_gender , add column, let's call parent, have query this
select p.id, p.value, x.id, x.value, a.id, a.email site_gender p inner join site_gender x on p.id = x.parent join user_account on p.id = a.id
here sql fiddle see how that's , work...
point of having parent column can choose 2 column want connect when have larger table parent column store id of column column should connected...
if have further question fill free ask!
gl!
Comments
Post a Comment