Home > database >  How to use the SQL statement: in September period, every one every day of the total amount paid is m
How to use the SQL statement: in September period, every one every day of the total amount paid is m

Time:09-27

There is a table
Table JE
Personal coding time site payment amount
1 A 20 2010-9-1
2 the 2010-9-3 B 30
1 C 50 2010-9-10
3 the 2010-9-10 B 30
1 A 50 2010-9-10
3 the 2010-9-10 A, 100


Now I'm going to check out a result: in September period, every one of us every day of the total amount paid more than 100 information, how to realize the query using SQL statements?

CodePudding user response:

Select individual coding, time, place, the sum () to the payment amount from je
Where the time between cast (' 20100901 'as a datetime)
'cast (' 20100930' as a datetime)
Group by individual coding, time, place having the sum () to the payment amount & gt; 100

CodePudding user response:

Every day oh, not in September the cumulative amount of oh!

reference 1st floor BTLCM response:
select individual coding, time, location, the sum () to the payment amount from je
Where the time between cast (' 20100901 'as a datetime)
'cast (' 20100930' as a datetime)
Group by individual coding, time, place having the sum () to the payment amount & gt; 100

CodePudding user response:

Select the individual number, to_char (time, 'yyyy - mm), sum (payment amount)
The from JE
WHERE to_char (time, 'yyyy - mm)=' 2010-09 '
GROUP BY individual number
HAVING the sum () to the payment amount & gt; 100

CodePudding user response:

Select individual coding, time, place, the sum () to the payment amount from JE
Where the time between '2010-9-1' and '2010-9-30 s'
Group by individual coding, time
Having the sum amount (personal) & gt; 100;

CodePudding user response:

The oracle:
Select individual coding time sum () to the payment amount from je
Where the time between to_date (' 2010-09-01 ', '- dd yyyy - mm) and to_date (' 2010-09-30', '- dd yyyy - mm)
Group by individual coding time
Having the sum () to the payment amount & gt; 100