you have an eror in your sql syntax.

解决方案 »

  1.   

    我这有问题,语法不正确,可能和sql严格模式关
      

  2.   

    create view v as 
    select qty,price,(qty*price) as value from t;
    这样呢? 
      

  3.   

    还是不行啊,难道不能创建视图?我是下载的APPSERV 带的phpmyadmin,在DOS环境下运行的mysql,为什么别的可以。偏篇这个不可以呢?
      

  4.   

    我测试了一下,又可以了,你把手册上的例子输入phpmyadmin中的SQl中运行一下看看,如果成功,删除
    再在dos中照着输一遍
      

  5.   

    还是不行。我下了高级版本的sql运行了。还是不行拉。怎么搞的。
      

  6.   

    mysql>create table t(qty int(4) primary key,price int(4)); 试一下
    没有主键好像不可以建表,
    字段需要长度吧
      

  7.   

    D:\Tools\MySQL4\bin>mysql -uroot -p
    Enter password: *******
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 30
    Server version: 5.0.51a-community-nt MySQL Community Edition (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> use ok
    Database changedmysql> create table  t(qty int,price int);
    Query OK, 0 rows affected (0.09 sec)mysql> insert into t values(3,50);
    Query OK, 1 row affected (0.02 sec)mysql> create view v as select qty,price,qty*price as value from t;
    Query OK, 0 rows affected (0.03 sec)mysql> select * from v;
    +------+-------+-------+
    | qty  | price | value |
    +------+-------+-------+
    |    3 |    50 |   150 |
    +------+-------+-------+
    1 row in set (0.02 sec)mysql>完全没有问题的哦
      

  8.   

    我想是我的sql版本不是5。0以上的原因。我先下了高版本的看看。