I am just close to madness... I am trying to figure out how to achieve a query that do the following.
I have a table users and a table user.profile in my joomla application. The users table has about 1800 records.
I just show below dummy tables:
table users
ID name surname dob
1 Smith John 06.01.2000
2 Doe Joe 25.08.1958
3 Meyer Holly 09.05.1960
table user_profiles
ID profile-key profile.value
1 profile.tel 123 453 456
1 profile.mobile 235 445 23
1 profile.address 22, Church Street
1 profile.city Dodge city
2 profile.tel 565 5654 32
2 profile.mobile 2528 25 1213
2 profile.address 1234, 6th Avenue
2 profile.city New London
3 profile.tel 457 578 45
3 profile.mobile 121 545 88
3 profile.address 3, North Street
3 profile.city Chicago
What I want is to achieve the following result:
Table 3
ID name surname dob profile.tel profile.mobile profile.address profile.city
1 Smith John 06.01.2000 123 453 456 235 445 23 22, Church Street Dodge city
2 Doe Joe 25.08.1958 565 5654 32 2528 25 1213 1234, 6th Avenue New London
3 Meyer Holly 09.05.1960 457 578 45 121 545 88 3, North Street Chicago
Now some SQL allows PIVOT command, but MySQLi does not. Can anyone show me how to get this task done?
What I am doing with table3 is to allow me to create a change table when compared with an other excel table with similar content in order to allow them to be "synchronized". Althogh not the best idea to have 2 separate tables with similar content, that is the way is is right now.
Thanks a lot for your help.
Adri
Thanks
Adri