SQL Help

Having problems installing that new stick of memory? Found some great software or having issues with something? Or maybe want to chat about your PlayStation, X-Box, Nintendo, Sega, even your old Spectrum 48k....! Or maybe something you want to sell or acquire (computing related of course!). Let us know here...
Post Reply
Ben
Posts: 1387
Joined: Wed Dec 19, 2007 12:00 am

SQL Help

Post by Ben »

Calling all SQL/MySQL gurus!

Just thought I'd post a techy related question here as I'm trying to design some software to manage 'tickets' (for support calls).

I have grasped the basics of using MySQL such as 'INSERT' and 'SELECT FROM' statements, however i seem to be having a problem with the 'UPDATE' statement which is bugging me!

Visual Basic.NET keeps telling me i have an error in the syntax somewhere but everytime i review it i can't seem to see a problem with it. The example statement is as follows: (ID is the unique identifier in this case)

UPDATE ticket SET Client_Name='XYZ' Client_Email='xyz@xyz.com' Client_Telephone='01234567890' Admin_DateComplete='NOW()' WHERE ID='5'

The actual statement is alot longer and includes many more fields, but i have shortened it so that it is easier to understand.

Am i doing the syntax wrong, or is there some other way to update just the 1 record based on ID number?


Many thanks for any surgestions as i'm stumped!  :?
Temujin
Posts: 2259
Joined: Mon Mar 13, 2006 12:00 am

Re: SQL Help

Post by Temujin »

You're doing it right Ben, well almost :D
You just need to comma separate your columns, like this
UPDATE ticket SET Client_Name='XYZ', Client_Email='xyz@xyz.com', Client_Telephone='01234567890', Admin_DateComplete='NOW()' WHERE ID='5'
Ben
Posts: 1387
Joined: Wed Dec 19, 2007 12:00 am

Post by Ben »

Thanks John! D'oh!  :oops:

Totally forgot about those commas... I also added a ';' to the end of the statement, and so far so good! Seems to update fine now!  :D
Post Reply