84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
突然想不想来这SQL应该怎么写
现在两字段time 为时间戳value 为某一笔交易金额如何用sql查出所有的天的交易金额统计,得到类似下面的数据,如果某一天没有记录,那就为0,但也查询出来,如下面18号
如果某一天没有记录,那就为0,但也查询出来,如下面18号
欢迎选择我的课程,让我们一起见证您的进步~~
"How to use SQL to find out the transaction amount statistics of all days"? ? What does it mean? Is it the total daily statistical amount?
SELECT FROM_UNIXTIME(time),'%Y-%m-%d') AS day,SUM(value) AS amount FROM table GROUP BY day; 未测试
select FROM_UNIXTIME(time, '%Y-%m-%d') AS day, sum(value) AS amount from table group by day
If you want to display the statistical date that does not exist, you need to implement it in the program
SELECT YEAR(time ) year, MONTH (time )month, DAY(time )day, SUM(value )amount FROM TABLE WHERE
"How to use SQL to find out the transaction amount statistics of all days"? ? What does it mean? Is it the total daily statistical amount?
select FROM_UNIXTIME(time, '%Y-%m-%d') AS day, sum(value) AS amount from table group by day
If you want to display the statistical date that does not exist, you need to implement it in the program
SELECT
YEAR(time ) year,
MONTH (time )month,
DAY(time )day,
SUM(value )amount
FROM
TABLE
WHERE