56,682
社区成员
发帖
与我相关
我的任务
分享
create trigger update_exceed BEFORE INSERT on A
for each row
begin
select count(*) into @ee from A where UserID=new.UserID;
if @ee>=5 then
insert into A(id) values(0);
end if;
end
select month(AddTime),sum(click)
from 表B
group by month(AddTime)
mysql> select '1'+'2';
+---------+
| '1'+'2' |
+---------+
| 3 |
+---------+
1 row in set (0.00 sec)
mysql>
select month(AddTime) as month,sum(cast(click as int)) as sum from tt where datepart(yy,AddTime)=2010 group by month(AddTime)
select top 20 year(AddTime) as year,sum(cast(click as int)) as sum from tt group by year(AddTime)