mysql - Using an IF() based on a query result -
i'm trying use if() mysql structure looks this:
if( phone_number '%992%' (select phone_number db.phonebook country='uk'), select xxx xxx xxx, select xxx xxx xxx )
i'm trying achieve:
if (if manage find phone number in 'uk' phonebook looks '992'), (run following xxx query), else (run following yyy query)
this doesn't work, syntax wrong. appreciate advice.
you can't via query - can using procedure - can't return resultset query (you can return string might contain query).
but it's not clear 'phone_number' somes before you've selected database.
perhaps if told explicitly queries wanted run on 2 possible scenarios , phone_number comes when might able help.
Comments
Post a Comment