CREATE ALGORITHM=TEMPTABLE VIEW view_u(u,f) as (SELECT a,r from r UNION ALL SELECT a,d from u)
我在mysql5.1版本的执行这个视图创建!但是报错啊!不知道应该怎么写啊!

解决方案 »

  1.   

    为什么要加上一对括号呢?mysql> create table r (a int,r int);
    Query OK, 0 rows affected (0.08 sec)mysql> create table u (a int,d int);
    Query OK, 0 rows affected (0.05 sec)mysql> CREATE ALGORITHM=TEMPTABLE VIEW view_u(u,f)
        -> as SELECT a,r from r UNION ALL SELECT a,d from u;
    Query OK, 0 rows affected (0.03 sec)mysql>