On Tue, Nov 13, 2001 at 10:04:22PM +0100, Martin MOKREJS wrote: > On Tue, 13 Nov 2001, Gerald Clark wrote: > > > Looks correct to me. > > What do you think is the problem? > > > > 2 rows were affected by the replace. > > One row was deleted, and one was inserted, > > Both rows had a value of 'test' for column 'Tab'. > > Cool, thanks to Jeremy Zawodny and you, now I know even more that I > do not know sql. Well, I told you that. ;) > > I thought that REPLACE replaces only fields which are different, so > if a line is missing, behaves as an insert, if the line is present, > behaves as an updates on columns which differ.
Not quite. REPLACE is a solution for the need to do this in your application: if (record_is_there) delete_it(); insert_it(); else insert_it(); endif MySQL determines if it is there by considering all primary keys and unique indexes. Jeremy -- Jeremy D. Zawodny, <[EMAIL PROTECTED]> Technical Yahoo - Yahoo Finance Desk: (408) 349-7878 Fax: (408) 349-5454 Cell: (408) 685-5936 MySQL 3.23.41-max: up 68 days, processed 1,511,292,029 queries (254/sec. avg) --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php