I am trying to run a query the gather various data depending on one of the table fields.
So basically if cotype is 1 I only want to check 1 possible match for name however if it is greater than 1 I have to check for multiplay name matches
SELECT * FROM mydirectory WHERE (cotype = '1' AND name='1' AND status='1' AND c_deleted='0') OR (cotype > 1 AND (name='1' OR name='2' OR name='2') AND status='1' AND c_deleted='0') ORDER BY cotype DESC, coname ASC
This will trigger resukts but it seems to run both queries not one or the other.
TIA
Aucun commentaire:
Enregistrer un commentaire