This is basically for testing an address book php application. Here is the output I got from the SQL query. I want to convert this results to a row.
MySQL Query output
Output looking for
This is basically for testing an address book php application. Here is the output I got from the SQL query. I want to convert this results to a row.
MySQL Query output
Output looking for
Try following query. Suppose postmeta is a table name
select a.contact_id,b.meta_value,c.meta_value,d.meta_value,e.meta_value
from postmeta a
join postmeta b on (a.contact_id=b.contact_id and b.meta_date='First_Name')
join postmeta c on (a.contact_id=c.contact_id and c.meta_date='Last_Name')
join postmeta d on (a.contact_id=d.contact_id and d.meta_date='Primary_Email')
join postmeta e on (a.contact_id=e.contact_id and d.meta_date='Primary_Phone')
Query
Fiddle demo