I want to update multiple rows that have specific count number (count(*)=2) with number 40. Consider the following example:
create table test(id int not null primary key, day date not null, tst int not null );
insert into test(id, day, tst) values(1, '2006-10-08', 0);
insert into test(id, day, tst) values(2, '2006-10-08', 0);
insert into test(id, day,tst) values(3, '2006-10-09', 0);
I have used the following query UPDATE test SET tst = 40 WHERE (select day from test GROUP BY day having count(*)=2);
But it never works. Any help please…
Thanks.
Aymen
Thanks God… Finally, we came up with working query: