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