Hi,
I need something like below query, i tried it but did not work error comes with "Syntax error"
select payments.id, payments.cid, payments.ctype, payments.date from payments
if(payments.ctype = 2, join clientst1 ON payments.cid = clientst1.cid)
elseif(payments.ctype = 3, join clientst3 ON payments.cid = clientst3.cid)
elseif(payments.ctype = 4, join clientst4 ON payments.cid = clientst4.cid)
Where
if(payments.ctype = 2, clientst1.customer_id = 4)
if(payments.ctype = 3, clientst3.customer_id = 4)
if(payments.ctype = 4, clientst4.customer_id = 4)
LIMIT 50;
Best Regards,