use php check the value, though mysql could do this.

解决方案 »

  1.   

    我就是写mysql,具体怎么写呢,不太明白
      

  2.   

    case when end, i'm trying
      

  3.   

    if  statfortime<'2007-06-07' 
    select statfortime,access,downloadfee from table where company = 12
    else
    select statfortime,sum(access),sum(downloadfee) from table where company in(12,156) group by statfortime
      

  4.   

    no result, and I've tried the method above.
      

  5.   

    qingwuwa(青无蛙) 的方法好像不行吧??
      

  6.   

    union得了,:-)
    ====================
    (select statfortime,access,downloadfee from test4 where statfortime<'2007
    -06-07') union (select statfortime,sum(access),sum(downloadfee) from test4 where
     statfortime>='2007-06-07' group by statfortime);
      

  7.   

    foolbirdflyfirst(湖水清澈)的方法试了,也不行
      

  8.   

    莫非我理解有误?不过这种条件判断应该交给程序去做.
    :-)
    ========================================================
    mysql> select version();
    +---------------------------------+
    | version()                       |
    +---------------------------------+
    | 5.2.0-falcon-alpha-community-nt |
    +---------------------------------+
    1 row in set (0.06 sec)mysql> select * from test4;
    +----+-------------+--------+-------------+
    | id | statfortime | access | downloadfee |
    +----+-------------+--------+-------------+
    |  1 | 2007-06-01  |      1 |           1 |
    |  2 | 2007-06-02  |      2 |           2 |
    |  3 | 2007-06-03  |      3 |           3 |
    |  4 | 2007-06-07  |      4 |           4 |
    |  5 | 2007-06-08  |      5 |           5 |
    |  6 | 2007-06-08  |      6 |           6 |
    +----+-------------+--------+-------------+
    6 rows in set (0.02 sec)mysql> (select statfortime,access,downloadfee from test4 where statfortime<'2007
    -06-07') union (select statfortime,sum(access),sum(downloadfee) from test4 where
     statfortime>='2007-06-07' group by statfortime);
    +-------------+--------+-------------+
    | statfortime | access | downloadfee |
    +-------------+--------+-------------+
    | 2007-06-01  |      1 |           1 |
    | 2007-06-02  |      2 |           2 |
    | 2007-06-03  |      3 |           3 |
    | 2007-06-07  |      4 |           4 |
    | 2007-06-08  |     11 |          11 |
    +-------------+--------+-------------+
    5 rows in set (0.00 sec)
      

  9.   

    +-------------+
    | version()   |
    +-------------+
    | 3.23.58-log |
    +-------------+我这个难道不能使??
      

  10.   

    MySQL 从4.0 的版本开始支持UNION 查询
    ==================================
    哥们,升级吧.