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
no result, and I've tried the method above.
qingwuwa(青无蛙) 的方法好像不行吧??
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);
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
====================
(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);
:-)
========================================================
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)
| version() |
+-------------+
| 3.23.58-log |
+-------------+我这个难道不能使??
==================================
哥们,升级吧.