actually it will act like insert in eather case. if its there, delete it first, if not just insert.
http://www.mysql.com/doc/en/REPLACE.html as far as using shell to do the insert/update, you could look at command line php, that way you get the logic and you don't have to learn a new language. #!/usr/bin/php4 -q <?php phpinfo(); ?> or if your always updating all columns and you don't use an auto_increment, you could get away with replace. On Thursday 16 October 2003 13:29, Brent Baisley wrote: > 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 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]