User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 397,720 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,559 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 249 | Replies: 2
Reply
Join Date: Jul 2008
Posts: 1
Reputation: tambia is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tambia tambia is offline Offline
Newbie Poster

Query help

  #1  
Jul 20th, 2008
Is there anyway to have (in one query) two separate queries? For example if query one fails then it will not affect the rest of it. Example code:

Say that the lastLogin table does not exist:
UPDATE userInfo SET lastLogin=3 WHERE id=5
UPDATE userInfo SET LastLogin=3 WHERE id=5

Is there anyway to get the second line to execute (in a single query) even though the first line would cause an error?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2008
Posts: 38
Reputation: varmadba is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 5
varmadba varmadba is offline Offline
Light Poster

Re: Query help

  #2  
Jul 21st, 2008
How will you run 2 separate queries in a single query

UPDATE userInfo SET lastLogin=3 WHERE id=5
UPDATE userInfo SET LastLogin=3 WHERE id=5

These are 2 update statements.if you want to run them in a sequence put SEMI COLAN at the end( that way even the first fails the rest will execute
:- Varma

Please Join My Mysql Community:
http://www.orkut.com/Community.aspx?cmm=52345386
Reply With Quote  
Join Date: Jul 2008
Location: Hyderabad,India.
Posts: 531
Reputation: Shanti Chepuru is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 53
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Posting Pro

Re: Query help

  #3  
Jul 21st, 2008
if you wrote two seperate update queries..
obviously, if the first one fails,the second one will execute..
Champions Are Not SuperNatural,They Just Fought For One More Second When Every One Else Quit...Some times That One Second Of Effort Gives You The VICTORY...
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MySQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 2:12 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC