It sound like you want to use REPLACE instead of the SELECT and INSERT/UPDATE combo. Replace will insert if the record doesn't exist and update if it does.


On Thursday, October 16, 2003, at 01:27 PM, Mike Tuller wrote:


I have a shell script that I have data entered into a database, and instead
of just entering in the data blindly, I want it to check to see if the item
it is entering exists already, and if it does, update the information rather
than inserting it. So I want to run a select statement, and if results come
back, have the data updated, and if not have it inserted.


I know how to do this in PHP with $query_total_rows. Is there some way in
SQL to do this, or do I need to figure out a way to do it in the shell
script?


Thanks,
Mike

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to