Mar-11-2020, 04:39 PM
New to python and am trying to firgure out how to do a MySQL query
Database table name is Customers
We have the customer fields named cfname, clname, caddress, ccity, cstate, and czipcode
Trying to do a search against the table Customers in which the first name and lastname are searched on or address,or city, or state or zip and return the results
The command I am trying:
mycursor.execute("""SELECT * FROM Customers WHERE cfname LIKE %s AND clname LIKE %s OR caddress LIKE %s OR ccity = %s OR cstate = %s or czipcode = %s""")%(dbcfname, dbclname, dbcaddress, dbccity, dbcstate, dbczipcode)
Thank you in advance
Tony
Database table name is Customers
We have the customer fields named cfname, clname, caddress, ccity, cstate, and czipcode
Trying to do a search against the table Customers in which the first name and lastname are searched on or address,or city, or state or zip and return the results
The command I am trying:
mycursor.execute("""SELECT * FROM Customers WHERE cfname LIKE %s AND clname LIKE %s OR caddress LIKE %s OR ccity = %s OR cstate = %s or czipcode = %s""")%(dbcfname, dbclname, dbcaddress, dbccity, dbcstate, dbczipcode)
Thank you in advance
Tony