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

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

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

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

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

×
哈哈.你们踢了那么久累不累啊?1 H- M+ ~, _  B+ l" L
会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来1 d. k  k0 a0 t) [+ i# y4 W( N
& H) U) z0 I5 {  G2 H' x. k
1 S% W7 O, E* o# w$ r% Q8 u, Y$ S2 m
4 U5 p% o5 I3 ^8 G# a
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
% S) p" w6 c9 O- S6 `: p- L3 Q9 o6 Z3 T

5 R. G# N6 n1 }# @$ G- H这个只看发帖者.并显示踢中次数
& Z! u+ m; d3 n# L- ?, J$ |哈哈.MYSQL不会.真累  `/ I" q! H% 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 编辑 ' G6 ~$ y8 `: b# o
, o9 a# [! }: o3 X
貌似只能按回复的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的话可以用* _1 S( o) g& k0 G, v
select distinct identity(int,1,1) ............ into
+ L7 t- |" Q  N% ?0 u 来生成楼层数
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 , e  J7 m+ |# i) ^/ z
select ( select count(*) as dd from pre_forum_post as a where  a.fid='863265' and a.tid='105' and a. ...

/ _0 i* v* b6 L4 N* iMySQL 返回: ' S. W' ~7 J' b
  o2 c% H8 ?# O6 f; q8 E. d
#1140 - Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause " Q8 G0 f( _9 J$ I
4 y. }+ E$ \0 ]
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
5 D9 o9 R5 o: K' @, p. f5 x/ I  y哈哈.你们踢了那么久累不累啊?" M4 ?; ]- @  J/ K' B0 j' r
会MYSQL语句的帮金光写个语句.然后好让他一次性查询出来
" v7 ]0 K9 d2 O* @7 c' k
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 年 5 月 23 日 04:25 , Processed in 0.102162 second(s), 26 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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