I revised the query. Hope this work:
stock_update_query = "UPDATE products SET stock = stock - (SELECT quantity FROM basket WHERE "
"basket.product_id = "
"products.product_id) "
"WHERE EXISTS (SELECT quantity "
"FROM basket "
"WHERE product_id = products.product_id)"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…