i have a question here… i have a 3 tables like this…
customer
idCustomer | namaCustomer | email | noTelp
__________________________________________________
1 | Wawan | a@a.com | 08985623895
attribute
idAttribute | Name | publish
______________________________
1 | Gender | Y
2 | Hobby | Y
3 | Job | Y
4 | Mission| N
Customer attribute
idCustomer | idAttribute | value
_____________________________________
1 | 1 | Male
1 | 2 | Hacking
1 | 3 | IT Support
The question is.. what query statement if i want to get the query from that 3 tables and get the result like this
idCustomer | namaCustomer | email | noTelp | Gender | Hobby | Job
___________________________________________________________________________________
1 | Wawan | a@a.com | 08985623895 | Male | Hacking | IT Support
So the table column was added from customer attribute data, but before that we must look attribute tabel that the attribute is published or not (looking for publish value)
anyone can help me here???
great thanks before
Try this:
SQL Fiddle Demo
However, for future use of this query for new attributes, you have to do it dynamically like so:
Dynamic Fiddle Demo