13平台收支.sql 1.1 KB

1234567891011121314151617181920212223242526
  1. -- Active: xiaoding_test@@192.168.110.85@3306@xiaoding_test
  2. /*
  3. 交易时间是wallet_trans_records表判断wallet_id字段值为1然后获取trans_time字段做为交易时间,
  4. 收入渠道是wallet_trans_records表判断wallet_id字段值为1然后获取owner_type字段做为收入渠道,
  5. 省份、城市、地区以及平台收入字段都是wallet_trans_records表判断wallet_id字段值为1然后分别获取province、city、district、amount字段即可
  6. */
  7. /* 查询平台收入明细 */
  8. DROP TABLE IF EXISTS report_platform_income;
  9. CREATE TABLE report_platform_income AS
  10. SELECT
  11. trans_time as trans_time /* 交易时间 */,
  12. owner_type as owner_type /* 收入渠道 */,
  13. province as province /* 省份 */,
  14. city as city /* 城市 */,
  15. district as district /* 地区 */,
  16. amount as amount /* 平台收入 */
  17. FROM
  18. wallet_trans_records wtr /* 钱包交易记录表 */
  19. WHERE
  20. wtr.wallet_id = 1 /* 平台钱包ID */
  21. AND wtr.deleted_at IS NULL /* 未删除的记录 */
  22. ORDER BY
  23. wtr.trans_time DESC /* 按交易时间倒序排序 */;