错误1349(HY000):视图的SELECT在FROM子句中包含一个子查询 [英] ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause

查看:332
本文介绍了错误1349(HY000):视图的SELECT在FROM子句中包含一个子查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想创建两个单独的视图.

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?

推荐答案

相反呢?

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
 );

这篇关于错误1349(HY000):视图的SELECT在FROM子句中包含一个子查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆