Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
P
project-credit
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • 互联网应用开发
  • project-credit
  • Wiki
  • sql

sql · Changes

Page history
chenchang created page: sql authored Aug 17, 2016 by 陈昌's avatar 陈昌
Hide whitespace changes
Inline Side-by-side
Showing with 19 additions and 0 deletions
+19 -0
  • sql.md sql.md +19 -0
  • No files found.
sql.md
View page @ 51a73f58
......@@ -13,6 +13,25 @@ select remain_times,used_times from `user_account` where `user_id` = 1 order by
SELECT time_index,data_value FROM user_account_log_statistics WHERE user_id = 1 AND data_key = 'consumption' AND time_index > 20160808 AND time_index < 20160816;
```
* Bin_Credit_AccountLogStatistics 脚本
```
SELECT user_id,type,COUNT(0) AS data_value FROM user_account_log WHERE times =20160816 GROUP BY user_id,type
```
对应表 :`user_account_log`;
查询条件:`times, user_id, type`;
* Bin_Credit_AccountLogStatistics 脚本
```
INSERT INTO personal_credit.user_account_log_statistics (user_id, time_index, data_key , data_value, create_time) VALUES
('1','20160816','consumption','88',UNIX_TIMESTAMP(NOW())),
('1','20160816','csdkfksfs','88',UNIX_TIMESTAMP(NOW())),
('2','20160816','consumption','88',UNIX_TIMESTAMP(NOW())),
('2','20160816','csdkfksfs','88',UNIX_TIMESTAMP(NOW())),
('3','20160816','consumption','88',UNIX_TIMESTAMP(NOW()))ON DUPLICATE KEY UPDATE data_value = VALUES(data_value)
```
对应表 :`user_account_log_statistics`;
查询条件:`time_index,user_id,data_key,data_value`;
* Bin_Credit_ApiLogStatistics 脚本
```
SELECT user_id, api_id, status, count(0) FROM personal_credit.api_log WHERE create_time >= 1471190400 AND create_time < 1471276800 GROUP BY user_id, api_id, status WITH ROLLUP HAVING user_id IS NOT NULL AND api_id IS NOT NULL
......
Clone repository
  • api
  • crontab
  • db
  • doc
  • files
  • Home
  • sql