I want to transpose the resulting column to row without using ranking method in MYSQL.
select pid , phone from mt where pid = 1 ;
Result :
pid phone
1 556
1 678
I want it in this format :
pid phone1 phone2
1 556 678
Similarly if execute a query which has only 1 value like the one below
select pid , phone from mt where pid = 2 ;
it should result in both the columns phone1 and phone2 but phone2 column should be null like the following .
pid phone1 phone2
2 123 NULL
How to proceed further ?