Home > database > A field date 7 days back income and work combined
A field date 7 days back income and work combined
Time:10-08
Requirements: Statistics each user in occupancy within 7 days of total amount and total amount of work done,
1, in time, every day there are users in 2, revenue, belongs to the cumulative index quantity, contains the number of the day Date of time_ru (in time) time_gz (work) userid (user ID) revenue (total income amount) quantity (total number) 20191001 20191001 aaa 1 1 20191001 20191002 aaa 4 3 September 8, 20191001, 20191003 aaa 12 12, 20191001, 20191004 aaa 20191001 20191005 aaa 18 17 20191001 20191006 aaa 25 20 20191001 20191007 aaa 30 22 20191024 20191024 BBB 5 2 20191024 20191025 BBB 6 8 20191024 20191026 BBB 12 10 18 14, 20191024, 20191027 BBB 20191024 20191028 BBB 22 19 28 22, 20191024, 20191029 BBB 20191024 20191030 BBB 35 26
I like writing, but always prompt error "ODPS - 0130071: [4 (] Semantic analysis exception - the function or the view 'time_ru' always be resolved "
The select userid , and count (distinct revenue) , and count (distinct quantity) , and count (distinct dateadd (time_ru (time_ru, 'yyyymmdd'), + 7, 'dd')) From a table Where ds>='20191001' and ds ='20191030'Group by userid
Consult everybody, how about to crazy date filter function to be play with
CodePudding user response:
Get everyone in the seventh day of the data can be