聶十八 发表于 2010 年 11 月 22 日 00:51:39

有懂SQL语句的帮金光整个法子

哈哈.你们踢了那么久累不累啊?
会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来



select ( select count(*) as dd from pre_forum_post as a wherea.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) as xuhao, author, subject, messagefrom pre_forum_post as b where b.fid='863265' and b.tid='105' and first=0 and mod(( select count(*) as dd from pre_forum_post as a wherea.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) ,25)=0

zyok 发表于 2010 年 11 月 22 日 00:52:13

不懂·······

聶十八 发表于 2010 年 11 月 22 日 00:55:40

select ( select count(*) as dd from pre_forum_post as a wherea.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) as xuhao, author, count(*)from pre_forum_post as b where b.fid='863265' and b.tid='105' and first=0 and mod(( select count(*) as dd from pre_forum_post as a wherea.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) ,25)=0


这个只看发帖者.并显示踢中次数
哈哈.MYSQL不会.真累
还是MSSQL比较容易懂

vica 发表于 2010 年 11 月 22 日 08:22:52

本帖最后由 vica 于 2010-11-22 08:23 编辑

貌似只能按回复的pid排序,没有楼层数的字段。

zyok 发表于 2010 年 11 月 22 日 08:31:40

高手········

聶十八 发表于 2010 年 11 月 22 日 09:03:06

vica 发表于 2010-11-22 08:22 static/image/common/back.gif
貌似只能按回复的pid排序,没有楼层数的字段。

哈哈。我就是按PID排序后再确定楼层的

三叶草 发表于 2010 年 11 月 22 日 09:19:18

高手,mysql和mssql大体上是一致的,可能函数名不一样,或者mysql不支持太复杂的子查询

聶十八 发表于 2010 年 11 月 22 日 09:40:07

mssql的话可以用
select distinct identity(int,1,1) ............ into
来生成楼层数

金光 发表于 2010 年 11 月 22 日 10:00:09

聶十八 发表于 2010-11-22 00:55 static/image/common/back.gif
select ( select count(*) as dd from pre_forum_post as a wherea.fid='863265' and a.tid='105' and a. ...

MySQL 返回:

#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause

金光 发表于 2010 年 11 月 22 日 10:00:27

聶十八 发表于 2010-11-22 00:51 static/image/common/back.gif
哈哈.你们踢了那么久累不累啊?
会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来



select ( select count(*) as dd from pre_forum_post as a wherea.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) as xuhao, author, subject, messagefrom pre_forum_post as b where b.fid='863265' and b.tid='105' and first=0 and mod(( select count(*) as dd from pre_forum_post as a wherea.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) ,25)=0
页: [1] 2
查看完整版本: 有懂SQL语句的帮金光整个法子