青禾BBS数据库查询语句(动网)
数据字典:https://files.cnblogs.com/ahauzyy/dvbbs.rar
查询用户信息:
SELECT * FROM dbo.Dv_User WHERE UserName='茗迹'
查询用户发帖总数:
SELECT UserTopic FROM dbo.Dv_User WHERE UserName='茗迹'
查询用户被删的帖子数:
SELECT UserDel FROM dbo.Dv_User WHERE UserName='茗迹'
查询用户所有发帖内容:
SELECT * FROM dbo.Dv_Topic WHERE PostUsername='茗迹'
查询用户有回复的帖子:
SELECT * FROM dbo.Dv_Topic WHERE PostUserName='茗迹' AND Child!=0 ORDER BY Child DESC
查询某一主题帖的回复内容所在表:
SELECT PostTable FROM dbo.Dv_Topic WHERE TopicID='130250'
查询某用户的所有回复贴:
SELECT * FROM Dv_bbs2 WHERE UserName='茗迹'
查询某一主题帖对应记录:
SELECT * FROM dbo.Dv_Topic WHERE TopicID='130250'
查询某一主题帖对应的回复记录:
SELECT * FROM dbo.dv_bbs2 WHERE RootID='130250'
查询某一主题帖回复人用户名:
SELECT DISTINCT UserName FROM dbo.dv_bbs2 WHERE RootID='130250'
查询某用户所发主题帖的所有回复帖记录:
SELECT * FROM Dv_bbs2 WHERE RootID =ANY(SELECT TopicID FROM dbo.Dv_Topic WHERE PostUserName='茗迹' AND Child!=0)
查询某用户所发主题帖的所有回复者记录和回复次数:
SELECT USERname AS '用户名',count(*) AS '回复次数' FROM Dv_bbs2 WHERE RootID =ANY(SELECT TopicID FROM dbo.Dv_Topic WHERE PostUserName='茗迹' AND Child!=0) GROUP BY UserName