mysql 查询三级或多级用户数量

mysql 查询三级或多级用户数量,第1张

select count(*) where fid=2

union

select count(*) where fid in select id where fid = 2

union

select count(*) where fid in select id where fid in select id where fid = 2

具体语法记不清了,差不多就是这种结构的

select a.ID,a.TID,a.NAME,b.DATE from (select b.ID,b.TID,b.DATE from B order by ID desc) as b left join A as a on a.TID=b.TID group by b.TID

而且你的表述有问题

1、等于说是 A表全部显示 且显示B 当中跟他关联的TID 最大的 那条记录值

这里应该是:当中跟他关联的ID 最大的

2、达到的效果也不对,因为B表的值写错了。

不知道你的时间是什么格式入库的,我一般习惯直接$_SERVER['REQUEST_TIME']或者time(),然后读的时候再格式化;

随便写一个你参考

$nowdate=date("Y-m-d")

select * from table where time='$nowdate' order by time desc limit 100

---------------------------------------

你可以做两个text,指定天数范围,然后循环提取


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/6143312.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-16
下一篇 2023-03-16

发表评论

登录后才能评论

评论列表(0条)

保存