From: Robert J Greene Date: March 13 1999 12:45am Subject: RE: Delete first found record in SQL select List-Archive: http://lists.mysql.com/mysql/131 Message-Id: <000701be6cea$c6c68a80$0200a8c0@ultracow> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit This isn't a perfect solution, but you could alter the table to include a unique id column: alter table aaa add column id int unsigned not null auto_increment, add key (id); (My test table was aaa -- real original, I know.) On my table, the new column had a unique id generated as part of the alter. Then, you can use a two-step process to knock the row out: select * from aaa where col1='abc' and col2='def' and col3='ghi' limit 1; delete from aaa where id=1; It would be pretty cool if the following would work: delete from aaa where col1='abc' and col2='def' and col3='ghi' limit 1; However, the LIMIT phrase isn't valid in a delete. Hope this helps a bit! -Rob > -----Original Message----- > From: Jann Linder [mailto:jann@stripped] > Sent: Thursday, March 11, 1999 9:46 PM > To: mysql@stripped; cgi-list@stripped > Subject: Delete first found record in SQL select > > > > > OS & PLATFORM: OH--forgot...using DBI w/perl 5 on Linux > > > --QUESTION: > I have a table with 3 fields. > > I have many records with IDENTICAL Fields. > > I want to pass the following: > > delete from tablename where a='a' and b='b' and c='c' > > and have the MySQL remove the FIRST RECORD ONLY where this > criteria is met. > > How is this possible? > > HLP ASAP! > Jann > > -- > Jann Linder > Web Developer > Perl Programmer > > Personal Site: http://www.jann.com/ > CalendarPlus Site: http://www.calendarplus.com/ > >