找回密码
 注册
广告投放 虚位以待【阿里云】2核2G云新老同享 99元/年,续费同价做网站就用糖果主机-sugarhosts.comJtti.com-新加坡服务器,美国服务器,香港服务器
查看: 644|回复: 14

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

  [复制链接]
发表于 2010 年 11 月 22 日 00:51:39 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
哈哈.你们踢了那么久累不累啊?
9 \3 _- a' f* S8 R/ T9 ~% B会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来9 N$ z: t/ h" h5 J, o+ L

! S. u1 w- K/ }6 A/ _) r% F! @5 m9 t2 n, F* I$ t4 _
1 V/ U2 e8 k) o9 b7 T3 p
select ( select count(*) as dd from pre_forum_post as a where  a.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) as xuhao, author, subject, message  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 where  a.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) ,25)=0
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
发表于 2010 年 11 月 22 日 00:52:13 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
不懂·······
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2010 年 11 月 22 日 00:55:40 | 显示全部楼层
select ( select count(*) as dd from pre_forum_post as a where  a.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 where  a.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) ,25)=0
& `0 X% `8 ~7 u3 d+ _6 i' R% S0 Q$ A9 v, t5 H% Z4 N2 N" M
* f- J1 i6 w/ v! d. b. A
这个只看发帖者.并显示踢中次数1 m: z2 ^/ \% x, f
哈哈.MYSQL不会.真累
2 C: I" w8 W6 E# |; z  V7 E& w! O8 G还是MSSQL比较容易懂
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2010 年 11 月 22 日 08:22:52 | 显示全部楼层
本帖最后由 vica 于 2010-11-22 08:23 编辑
  x* y7 O9 W+ N
. m: Z& z$ @% }+ q8 w) \貌似只能按回复的pid排序,没有楼层数的字段。
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2010 年 11 月 22 日 08:31:40 | 显示全部楼层
高手········
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2010 年 11 月 22 日 09:03:06 | 显示全部楼层

点评

不过可以看下显示楼层数的页面代码是什么,直接写个页面填帖子ID搜楼层也行。  发表于 2010 年 11 月 22 日 09:36
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2010 年 11 月 22 日 09:19:18 | 显示全部楼层
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
高手,mysql和mssql大体上是一致的,可能函数名不一样,或者mysql不支持太复杂的子查询
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

 楼主| 发表于 2010 年 11 月 22 日 09:40:07 | 显示全部楼层
mssql的话可以用' O+ }0 }. {# v* Q  _1 _6 U
select distinct identity(int,1,1) ............ into
1 [# ?2 V$ T; E) v8 z7 y 来生成楼层数
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2010 年 11 月 22 日 10:00:09 | 显示全部楼层
聶十八 发表于 2010-11-22 00:55 4 R# v3 c0 [% O- G+ m
select ( select count(*) as dd from pre_forum_post as a where  a.fid='863265' and a.tid='105' and a. ...

2 T: f9 L9 q& a8 H9 [, ]& LMySQL 返回:
0 Q+ Z1 k+ a9 P) _6 j0 r, b9 }) q9 F3 c
#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
1 h; |- `9 v! b% D# Q% K
$ z  i4 E; D4 H$ L+ b
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

发表于 2010 年 11 月 22 日 10:00:27 | 显示全部楼层
聶十八 发表于 2010-11-22 00:51 + W; B3 G+ q% {: D, J
哈哈.你们踢了那么久累不累啊?) D8 V  p. B7 O  i" A
会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来

. [  B7 V  P- Q7 l: n0 z" Z& ^0 kselect ( select count(*) as dd from pre_forum_post as a where  a.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) as xuhao, author, subject, message  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 where  a.fid='863265' and a.tid='105' and a.pid<b.pid order by pid) ,25)=0
Jgwy.Com - Free Web Hosting Guide & Directory In China since 2001! Jgwy.Net-Jglt.Net
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|金光论坛

GMT+8, 2025 年 6 月 3 日 19:39 , Processed in 0.117300 second(s), 28 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表