【发布时间】:2020-07-08 17:17:44
【问题描述】:
我有以下 Oracle 表:
GAMES
id_game int
id_user int
dt_game DATE
在创建新记录之前,我必须检查同一用户每天插入游戏的次数不超过 N 次。
我实际上是这样选择今天玩的游戏数量的:
select count(1) as num from GAMES
where id_user=ID_USER and
to_char(dt_game,'DD/MM/YYYY')=to_char(sysdate,'DD/MM/YYYY')
我不太喜欢。有没有更好的方法?
提前致谢。
【问题讨论】:
标签: performance oracle