我不想创建两个单独的视图。
create view fg_voted as (
select *
from (select f1.foto, count(f1.vote) stars,f1.vote, f1.voted
from fg_foto_bewertung f1
where f1.vote >= 3 group by f1.foto, f1.vote) vi_foto
where stars > 3);
如何在单个查询中编写它以创建视图?
答案 0 :(得分:1)
相反怎么样?
create view fg_voted as (
SELECT f1.foto,
count(f1.vote) stars,
f1.vote,
f1.voted
FROM fg_foto_bewertung f1
WHERE f1.vote >= 3
GROUP BY f1.foto,
f1.vote,
f1.voted
HAVING count(f1.vote) > 3
);