Page 1 of 1

Query Required

Posted: Sat Oct 30, 2010 3:08 am
by suleman
i require query for following scenario
I have two table
table1 have following columns
person_id
Name
gender

and has 1 record
person_id Name gender
1 Robert Male

and table2 has following column

person_id
result1

and has following 3 rows

person_id result
1 php1
1 php2
1 php3


I need query for displaying result like this

Robert male php1 php2 php3

Re: Query Required

Posted: Sun Nov 07, 2010 2:04 pm
by DigitalMind
that's impossible

Re: Query Required

Posted: Sun Nov 07, 2010 3:10 pm
by mikosiko
DigitalMind wrote:that's impossible
psssht.... :wink: GROUP_CONCAT :wink:

Re: Query Required

Posted: Mon Nov 08, 2010 4:36 pm
by DigitalMind
mikosiko wrote: GROUP_CONCAT
yes, if we want to output it as a single field.
you're right :)
probably i misunderstood the question. i thought it needs to output result as separate fields :) it was sunday's midnight... :)

Re: Query Required

Posted: Mon Nov 08, 2010 5:00 pm
by VladSun
If there are always 3 rows () in person_id result, then one could create some kind of a cross-table query ... but only and if only there are always 3 rows in person_id result. Which on the other hand sounds like a redundant "db normalization".