I'm trying to join two tables but the last one twice. What I've got is this:
Table 1
id name email
476 Lars Lyngsoe [email protected]
478 Lars2 Lyngsoe2 [email protected]
495 Lars3 Lyngso3 [email protected]
Table 2
user_id profile_key profile_value
476 'profile.klasse' '10A'
495 'profile.klasse' '10B'
476 'profile.phone' '12345678'
478 'profile.klasse' '10A'
478 'profile.phone' '23432123'
495 'profile.phone' '21212143'
Where id in Table 1 equals user_id in Table 2
I've tried to join and make subqueries but nothing works. What I want to achieve is this:
Table
id name email class phone
476 Lars Lyngsoe [email protected] '10A' '12345678'
478 Lars2 Lyngsoe2 [email protected] '10A' '23432123'
495 Lars3 Lyngso3 [email protected] '10B' '21212143'
Thank's for your help.
Lars