mysql数据库,有一个表t1,字段:a,b,c,d
我想做运算,a+b-c形成的结果集合,按照升序(降序也可)排列,怎么做呢?
select a+b-c as result  from  t1  order by result asc
通不过,请帮助我,谢谢

解决方案 »

  1.   

    你用的mysql版本号是多少?报什么错?
    我的似乎可以通过。mysql> create table t7(a int, b int, c int, d int);
    Query OK, 0 rows affected (0.03 sec)mysql> insert into t7 values(1, 1, 1, 1), (2, 3, 4, 1);
    Query OK, 2 rows affected (0.00 sec)
    Records: 2  Duplicates: 0  Warnings: 0mysql> select a+b-c as result from t7 order by result;
    +--------+
    | result |
    +--------+
    |      1 |
    |      1 |
    +--------+
    2 rows in set (0.00 sec)mysql>