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

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

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

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

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

×
哈哈.你们踢了那么久累不累啊?0 O8 A5 M9 s8 d
会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来
- x3 H7 B' {# R6 u& ~- ~+ _) N) C% E

. ~+ |1 ~+ T7 M9 G8 c5 W: n0 _
/ H" R1 [3 C1 D& D9 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
发表于 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
9 D6 j; k& Y. k: I; E
& S: n- y, h7 q$ m* \
1 |: U! \8 C4 w8 R8 T这个只看发帖者.并显示踢中次数( q& D3 H0 }; @  v, {1 r9 Z
哈哈.MYSQL不会.真累" p. u5 [3 ?/ d. O. T  l0 v# f( d
还是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 编辑
) I1 v! V/ z. f( z9 l
) {' i; u3 {; J1 i貌似只能按回复的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的话可以用
6 k/ h8 z- ]& ^! Sselect distinct identity(int,1,1) ............ into9 b9 I" ]# e3 A" b7 Z% N% l6 V
来生成楼层数
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 u# L+ R4 X0 ?8 E1 T
select ( select count(*) as dd from pre_forum_post as a where  a.fid='863265' and a.tid='105' and a. ...
. L1 d9 t/ L& W) S
MySQL 返回: 3 W+ @, J  h2 _. ]3 g

3 E6 E8 K4 d6 J  y$ R#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause : U: G7 Y8 \$ v. C& ^
- A- _1 u  f5 o( D  L5 h
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 8 {& B; O/ c7 `4 P9 r. W1 s
哈哈.你们踢了那么久累不累啊?
3 n8 v8 {. P' E8 v会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来
, b# B& Z4 ^7 N6 ^% M6 e
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
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025 年 2 月 12 日 18:16 , Processed in 0.049402 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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