Solved

Python mysql update error

Posted on 2015-02-22
1
188 Views
Last Modified: 2015-02-22
I am trying to update a table (customerorder) for columns CustomerID, DelDate,DelTime and TotalCost - in row where (in this example) Key OrderID = 323. The function 'UpdateCustomerOrderinfo' below is used within the action page which supports the input form.

The error message below indicates some subtle syntax code. Hopefully you might spot it.

Tks for any assistance

def UpdateCustomerOrderInfo(db,cursor):
      cursor.execute ("""
         UPDATE customerorder
         SET CustomerID=%s, DelDate=%s, DelTime=%s, TotalCost=%s
         HAVING OrderID=%s
      """, (CustomerID, DelDate, DelTime, TotalCost, OrderID)) 

Open in new window



rs.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HAVING OrderID='423'' at line 3

Open in new window

0
Comment
Question by:jameskane
1 Comment
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40623963
I think you need to use WHERE instead of HAVING.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Duplicating MySQL Table columns 5 37
selecting date modified field from a table 2 44
Sql query on a varchar that is numeric. 8 35
update joined tables 2 45
Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question