我对我的我的我的我的我的卡勒发言有问题:
select sum(x) as "sum", "01.06.2010" as "date" from (
select distinct a.id as ID, a.dur as x from b_c
inner join c on b_c.c_id = c.id
inner join a on c.id = a.c_id
inner join a_au on a.id = a_aud.id
inner join d on a_au.rev = d.rev
where
b_c.b_id = 30 and
a_au.stat != 1 and
DATE(FROM_UNIXTIME(rtime)) = DATE( 2010-06-01 )
) AS SubSelectTable;
这份声明一行“摘要”和“日期”。
现在我不仅有一个日期(2010-06-01),而且我有许多日期要拿到这笔钱,而不是一个单行。 我希望每天有一次结果。
因此,例如,上述发言使我返回。
sum date
-------------------
20 01.06.2010
Now I have the dates 2010-06-01, 2010-06-02, 2010-06-03, ... What I can do is to write for every date one sql statement changing the DATE. So if I have 10 dates, I will have 10 sql statements for the database. But I did want it with one SQL statement, and the result should not be the sum of all given dates, I want to have one result row per date. So the result should like that:
sum date
-------------------
20 01.06.2010
133 02.06.2010
19 03.06.2010
88 04.06.2010
... ...
我如何能够这样做? 是否有任何人知道?
Thanks advance lot