日期过程不同

时间:2014-03-28 12:58:33

标签: mysql

我的表格JobOrder有5列:( jo_nojo_typejo_releasejo_datejo_livedate

使用下面的MySQL查询,我正在计算jo_type

select jo_no, jo_date, jo_livedate, count(*) from joborder
where jo_no='1232';

输出:

+-------+-----------+-------------+----------+
| jo_no | jo_date   | jo_livedate | count(*) | 
+-------+-----------+-------------+----------+
| 1232  | 01-dec-14 | 05-dec-14   | 5        |
+-------+-----------+-------------+----------+

我想输出jo_datejo_livedate的差异。如果差异是5天,我需要生成5条记录,如下所示......

+-------+-----------+-------------+
| jo_no | date      | count(*)**  | 
+-------+-----------+-------------+
| 1232  | 01-dec-14 | 5           |
+-------+-----------+-------------+
| 1232  | 02-dec-14 | 5           |
+-------+-----------+-------------+
| 1232  | 03-dec-14 | 5           |
+-------+-----------+-------------+
| 1232  | 04-dec-14 | 5           |
+-------+-----------+-------------+
| 1232  | 05-dec-14 | 5           |
+-------+-----------+-------------+

0 个答案:

没有答案