Subject Re: [firebird-support] Results of query
Author Helen Borrie
At 09:18 PM 26/12/2007, you wrote:
>create table test(id int, val char(5));
>insert into test values(1, 'red');
>insert into test values(2, 'green');
>insert into test values(3, 'blue');
>insert into test values(2, 'green');*/
>delete from test
> where test.ID in (select id from test GROUP BY id HAVING count(id)>1);
>What results must be and why?select * from test;id value
>-- -----
>01 red
>02 green
>03 blueORid value
>-- -----
>01 red
>03 blue

The second result is the correct one. Your DELETE query removes all records where the HAVING clause is true, i.e. *both" instances of (2,green).

./heLen