mysql-error-1349

ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause

杀马特。学长 韩版系。学妹 提交于 2020-01-03 05:46:32
问题 I do not want to create two separate views. 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); How can I write it in a single query to create view? 回答1: How about this instead? 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

MySQL: View with Subquery in the FROM Clause Limitation

邮差的信 提交于 2019-11-26 02:36:31
问题 In MySQL 5.0 why does the following error occur when trying to create a view with a subquery in the FROM clause? ERROR 1349 (HY000): View\'s SELECT contains a subquery in the FROM clause If this is a limitation of the MySQL engine, then why haven\'t they implemented this feature yet? Also, what are some good workarounds for this limitation? Are there any workarounds that work for any subquery in the FROM clause or are there some queries that can not be expressed without using a subquery in