直接上sql语句SELECT
(
SELECT
SUM(money)
FROM
chongzhi
WHERE
`user` = 18
AND leixing IN (1, 5)
) 转账金额,
(
SELECT
sum(moneydan)
FROM
daifu
WHERE
USER = 18
) 接口金额,
a.实际余额,
a.目前余额,
(
a.实际余额 - a.目前余额
) 相差额度,
(
SELECT
b.moneys
FROM
(
SELECT
FROM_UNIXTIME(modify_time, '%Y-%m-%d') days,
SUM(moneydan) moneys
FROM
daifu
WHERE
`user` = 18
GROUP BY
days DESC
LIMIT 0,
1
) AS b
) AS 今日支付,
(
SELECT
b.moneys
FROM
(
SELECT
FROM_UNIXTIME(modify_time, '%Y-%m-%d') days,
SUM(moneydan) moneys
FROM
daifu
WHERE
`user` = 18
GROUP BY
days DESC
LIMIT 1,
1
) AS b
) AS 昨日支付
FROM
(
SELECT
(
(
SELECT
SUM(money)
FROM
chongzhi
WHERE
`user` = 18
AND leixing != 6
) + (
SELECT
sum(moneydan)
FROM
daifu
WHERE
`user` = 18
)
) AS 实际余额,
(
SELECT
moneyafter
FROM
chongzhi
WHERE
`user` = 18
ORDER BY
create_time DESC
LIMIT 1
) AS 目前余额
) a
结果图
转载声明:本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动。
欢迎捐赠赞赏