mikosiko
-
Posts
1,327 -
Joined
-
Last visited
-
Days Won
1
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Complex query call in php
in MySQL Help
Posted
Your explanation is not so clear... do you mean that you need to select some columns from table CFBP and from table CFBG and in case that CFBP.Pick =1 select the column CFBG.Away and in case CFBP.Pick=2 select the column CFBG.Home ? (I didn't include the WHERE to simplify).
If that is what you want then the function ELT should solve it... like
SELECT CFBP.<some column>,
ELT(CFBP.Pick, CFBG.Away, CFBG.Home) AS "something"
FROM CFBP LEFT JOIN CFBG ON CFBP.Game_ID = CFBG.ID
WHERE CFBP.User_ID = $user;