Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 2nd, 2007, 08:12 AM
Authorized User
 
Join Date: Apr 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Is this possible in sql? Pratically its possible

can we have update and delete together in one single query?

Assume a table
Table (refcount INTEGER, Name STRING)
Name: is the name of the patient in the hospital,
RefCount: is the number of people with the same name.

Now at the time of addition to the table i must check whether that name already exists, if it exists increment the refcount by 1, if it doesn't insert (1, the given name). Can i do this in single step? Practically its possible to do this in single search of the table. How do we do it in SQL with single search on table?

Likewise i want the delete operation. If a patient is discharged, his name refcount should be reduced by 1, and if the refcount bercomes zero then that row entry must be deleted. Again we have similar situation, Practically its possible to do this in single search of the table. How do we do it in SQL with single search on table?




__________________
Regards,
Phani
 
Old May 2nd, 2007, 08:16 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

X Post:
http://p2p.wrox.com/topic.asp?TOPIC_ID=59655

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old May 2nd, 2007, 08:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

bvpsekhar,

I dont really understand why you opened another thread when you were getting response for the one you posted here on the same earlier.

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
How Run .sql Script file in MS SQL Server 2000? aarkaycee SQL Server 2000 5 October 12th, 2009 05:43 AM
creating ssis packagte for sql server to sql serer Laxmikant_it ASP.NET 3.5 Professionals 0 November 26th, 2008 12:23 AM
Converting from MS SQL 2005 to Sql Epress edition saif44 SQL Language 0 February 16th, 2007 04:17 PM
Failed to copy objects from SQL server to SQL Serv monfu SQL Server 2000 4 December 4th, 2005 05:54 PM
Move SQL DB from one sql to another sql server Israr SQL Server 2000 3 January 24th, 2005 02:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.