如何根据日期和时间选择数据 [英] How to select data based on date and time
本文介绍了如何根据日期和时间选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
Hi all
bill_no datetime amount
1; "2014-12-23 17:36:07"; 382.02
1; "2014-12-23 09:08:37"; 1452.38
2; "2014-12-23 18:18:26"; 472.99
2; "2014-12-23 09:56:44"; 380.95
3; "2014-12-23 10:00:07"; 666.67
3; "2014-12-23 18:42:43"; 159.18
4; "2014-12-23 10:12:54"; 200.00
4; "2014-12-23 18:43:25"; 77.31
5; "2014-12-23 10:15:21"; 7857.14
5; "2014-12-23 18:45:27"; 409.31
6; "2014-12-23 20:50:56"; 318.36
6; "2014-12-23 10:16:00"; 761.90
7; "2014-12-23 20:59:59"; 109.16
7; "2014-12-23 10:16:58"; 1571.43
这里如何获取所有bill_no的总和,具体取决于日期时间。
现在,如果我正在尝试总和(金额)它只从重复行中获取单个值。
请告诉我该怎么做..
Here how to get the total of all the bill_no's depending on datetime.
now if i am trying sum(amount) it's taking only single values from the duplicate rows.
Please tell me how to do this..
推荐答案
你应该试试这个
You should try this
SELECT bill_no, sum(amount) as net_total FROM tbl_transaction_master
WHERE bill_date >='2014-12-23 00:00:00' AND bill_date <='2014-12-23 23:59:59'
GROUP BY bill_no
ORDER BY bill_no
它适用于你:)。
谢谢。
it will work for you :) .
Thank you.
这篇关于如何根据日期和时间选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文