Programming in mysql: Different mysql join query based on user level on newest questions tagged mysql – Stack Overflow
I’m seeking an idea or best practice to perform the below:
I have the tables:
profile contains basic info (id, email, pass, lvl)
profile_user contains (pid, name, age, etc..)
profile_mod contains (pid, company_name, money, etc..)
as you can see that I will do left join on two tables to get the whole information, but the join will be all based on the attribute lvl. If lvl=1 it will leftjoin on profile_user and lvl=2 will perform join on profile_mod.
My question is, I don’t want to perform a check on every query to get the lvl and then do the leftjoin on the other two tables. I was wondering if there is a best practice for such case.
source: http://stackoverflow.com/questions/11706175/different-mysql-join-query-based-on-user-level
Programming in mysql: programming-in-mysql
Recent Comments