I have two tables 'contactinfo' contains 3 fields-- key,ContactModeList_pkey,value,whosinfo_pkey.
'whosinfo' contains fields-- pkey,hisPkey.Here 'contactinfo' table contains 2 rows for the same 'pkey' values.(The 'contactinfo' table contains two data for single whosinfo_pkey)
select whos.hisPkey ,
IF(ContInfo.ContactModeList_Pkey = 1, value, '') 'Mobile',
IF(ContInfo.ContactModeList_Pkey = 2, value, '') 'Email'
from whosinfo whos,contactinfo ContInfo where whos.pkey=ContInfo.whosInfo_pkey
and whos.pkey = '397';
The data in table 'contactinfo' as 422,1,8708708700,397 in next row 423,2,8708708700,397.The data in table 'whosinfo' as 397,401.
The ouput will be as following:
| hisPkey | Mobile | |
| 401 | 8708708700 | |
| 401 | [email protected] |
| hisPkey | Mobile | |
| 401 | 8708708700 | [email protected] |

Iftikar HussainPosted Jul 22, 2013, 4:29 AM
Try like this
Regards,
Iftikar
Iftikar HussainPosted Jul 22, 2013, 5:02 AM
Regards,
Iftikar
Kavi sujaPosted Jul 22, 2013, 4:58 AM
Thank you for your reply.It's working for me.
Renish PatelPosted Jul 22, 2013, 4:00 AM
You have to used GROUP_CONCAT() function in MY SQL to solve your problem..
Here i share link for you,which will explain you every things which you want..
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
If you get your answerd then make this post as answered..
Happy Coding..
Thanks
Renish Ankola