我希望能做类似以下的事情:
当我尝试时,出现错误:
select
case when (select count(*) as score from users t1 ) >5 THEN score else 0 end
当我尝试时,出现错误:
column score doesn't exists.
我可以用其他方法吗?我需要设置一个LIMIT值。当然,我希望以这种方式完成:
select
case when (select count(*) as score from users t1 ) >5 THEN (select count(*) as score from users) else 0 end
但是我需要执行两次相同的查询,你有什么想法吗?