Python Forum
How do you format Update statement with multiple conditions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you format Update statement with multiple conditions
#1
Below shows a workableUpdate format for changing 1 field with 1 Where condition. I understand how the Bobby Table Format association works here.
What would the Format look like with multiple field changes and multiple conditions?

def update_cowTbl(self,tagNoC,tagClrC,tagYrC,tagNoV,tagClrV,tagYrV):
self.c.execute("UPDATE cowTbl SET tagNo=? WHERE tagNo=?",(tagNoV,tagNoC))
self.con.commit()

What does not work: ("UPDATE cowTbl SET tagNo=?,tagClr=? WHERE tagNo=?,tagClr=?",(tagNoV,tagNoC),(tagClrV,tagClrC))
Larz60+ write Dec-16-2021, 04:42 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Please use bbcode tags, it's a forum rule.
Reply


Messages In This Thread
How do you format Update statement with multiple conditions - by hammer - Dec-16-2021, 02:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  An unexplainable error in .format statement - but only in a larger piece of code? ToniE 4 741 Sep-05-2023, 12:50 PM
Last Post: ToniE
Question Using SQLAlchemy, prevent SQLite3 table update by multiple program instances Calab 3 792 Aug-09-2023, 05:51 PM
Last Post: Calab
  String concatenation in SQL update statement hammer 3 1,571 Feb-24-2022, 08:00 PM
Last Post: hammer
  multiple condition if statement problem FelixReiter 3 2,642 Jan-11-2021, 08:07 AM
Last Post: FelixReiter
Question Python + Google Sheet | Best way to update specific cells in a single Update()? Vokofe 1 2,724 Dec-16-2020, 05:26 AM
Last Post: Vokofe
  Multiple conditions when indexing an array with or without np.where noob2305 1 2,703 Oct-25-2020, 02:06 PM
Last Post: jefsummers
  Looking for help in Parse multiple XMLs and update key node values and generate Out.. rajesh3383 0 1,894 Sep-15-2020, 01:42 PM
Last Post: rajesh3383
  Multiple conditions, one is null moralear27 1 2,225 Sep-13-2020, 06:11 AM
Last Post: scidam
  MYSQL Update Query format simdo01 1 2,252 Aug-31-2020, 12:59 AM
Last Post: nilamo
  multiple number format conversion oli_action 4 2,613 Aug-11-2020, 05:10 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020