In <[email protected]> Anatoli Hristov
<[email protected]> writes:
> I have a situation where I compare the SKU in my DB and there are some
> SKU that are with lowercase and some with uppercase, how can I solve
> this in your opinion ?
> def Update_SQL(price, sku):
> db = MySQLdb.connect("localhost","getit","opencart",
> use_unicode=True, charset="utf8")
> cursor = db.cursor()
> sql = "UPDATE product SET price=%s WHERE sku=%s"
> cursor.execute(sql, (price, sku))
> db.commit()
> db.close()
I think this will work:
sql = 'UPDATE product SET price=%s WHERE LOWER(sku)=%s'
cursor.execute(sql, (price, sku.lower())
--
John Gordon A is for Amy, who fell down the stairs
[email protected] B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list