mysql创建视图不能包涵子查询的解决办法。View's SELECT contains a subquery in the FROM clause
来源:互联网 发布:远程控制监控软件 编辑:程序博客网 时间:2024/04/28 19:43
如下查询是没问题,但要创建成视图就报View's SELECT contains a subquery in the FROM clause错误。
CREATE or REPLACE VIEW `v_user_adunion_reg` AS
select a.name as user_name,b.* from t_users a,t_adunion_result b where a.id = b.userid and orderid is null and czid is null and txid is null and bkid IS null and hbid is null
and b.id in (select id from (select c.userid,min(c.id) as id from t_adunion_result c group by c.userid ) as d);
执行这句会报错。
解决办法:通过创建中间视图作关联查询解决。
CREATE or REPLACE VIEW `v_user_adunion_regsub` AS
select c.userid,min(c.id) as id from t_adunion_result c group by c.userid;CREATE or REPLACE VIEW `v_user_adunion_reg` AS
select a.name as user_name,b.* from t_users a,t_adunion_result b,v_user_adunion_regsub c where a.id = b.userid and b.id =c.id and orderid is null and czid is null and txid is null and bkid IS null and hbid is null ;
0 0
- mysql创建视图不能包涵子查询的解决办法。View's SELECT contains a subquery in the FROM clause
- mysql 创建视图出现1349 View's SELECT contains a subquery in the FROM clause解决办法
- mysql创建视图 :View's SELECT contains a subquery in the FROM clause
- Mysql创建视图 :View's SELECT contains a subquery in the FROM clause
- mysql创建视图时出现 #1349 - View's SELECT contains a subquery in the FROM clause
- mysql 创建视图时提示View's SELECT contains a subquery in the FROM clause
- mysql #1349 - View's SELECT contains a subquery in the FROM clause 错误
- 在视图或者子查询中查询rowid出错提示cannot select ROWID from a join view without a key-preserved table
- MySQL子查询(subquery)分类
- mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题
- mysql遇见Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre的问题
- 每日MySQL之026:MySQL的子查询(subquery)
- MySQL数据库update更新子查询[Err] 1093 - You can't specify target table 'text' for update in FROM clause
- MySQL: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column '
- The filter pushed in subquery issue in oracle 11G (filter推进子查询)
- mysql创建视图包含子查询的解决方法
- [mysql] Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'lo
- MySQL报错“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”
- 9.template -- basic concepts
- Linux 内核剖析
- mingw(gcc)编译libjpeg-turbo
- UIView.clipsToBounds 让子 View 只显示落在父 View 的 Frame 部分
- 实验8-2-5 判断回文字符串 (20分)
- mysql创建视图不能包涵子查询的解决办法。View's SELECT contains a subquery in the FROM clause
- ASP.NET MVC中实现多个按钮提交的几种方法
- {iOS} NSJSONSerialization解析和保存JSON String
- 用 addr2line 定位 OOPS 死机代码位置
- 数据科学家
- WordPress中的多语言支持
- tablespace
- javascript+div弹出框(拼接页面)
- 关于GBK中的英文字符占用一个字节还是两个字节的问题