I know there’s got to be a way to do this, but for the life of me I can’t figure it out:
I have 3 tables I want to join together (simplified to illustrate):
users
uid mail
1 qq@qq.com
2 ww@ww.com
3 ee@ee.com
profile_fields
fid name label
1 full_name Full Name
2 phone Phone
profile_values
uid fid value
1 1 Q Q
1 2 5555555555
2 1 Ww Ww
3 2 4444525411
I’d like to get results of the form:
uid mail full_name phone
1 qq@qq.com Q Q 5555555555
2 ww@ww.com Ww Ww NULL
3 ee@ee.com NULL 44445454111
I’ve tried various SELECTs with different JOIN conditions but I can’t seem to figure out how to get the rows of profile_fields to be my columns in my SELECT
EDIT: I’ve also tried googling around, but I can’t seem to figure out how to phrase this to google.
Use: