I\'m sure this has been ask/answered already but I don\'t know how this kind of action is called and my SQL knowledge is limited.
I\'m searching for a single SQL statem
Another simple way to fetch data using subquery.
SELECT hash, (select value from USER_FIELD where key = 'firstname' and user_id=6 ) as firstname, (select value from USER_FIELD where key = 'lastname' and user_id=6 ) as lastname FROM `USER` where ID = 6
but it is not good way. You will have to compromise with performance, if database goes large. You should use another design pattern.