Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[已答复] 数据库语句问题....帮个忙啊...急...标题要长长长长长长长长长长长长长长长长长长长长

[复制链接]
楼主骗子 发表于 2009-10-20 11:23:01 | 显示全部楼层 |阅读模式
本帖最后由 楼主骗子 于 2009-10-20 11:25 编辑

今天建了一个模型,现在首页调用此模型的一些信息就写了一个模块
SQL:
select * from supe_hqitems a , supe_hqmessage b
where a.itemid=b.itemid and a.subject = (select subject from supe_hqitems where catid = 1 order by dateline desc limit 0,1) order by dateline desc
这个语句在PHPMYADMIN里测试是成功的!
放到模块里以后,首页调用时就出错了.
错误:
SupeSite info: MySQL Query Error

User: xxx
Time: 2009-10-20 11:15am
Script: /ss/index.php

SQL: SELECT * from [Table]hqitems a , [Table]hqmessage b
where a.itemid=b.itemid and a.subject = (select subject from [Table]hqitems where catid = 1 order by dateline desc LIMIT 0,20
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
Errno.: 1064

这个语句也变掉了??? 怎么回事?
没接触过MYSQL 只懂点MSSQL,不知道这种语句要怎么写比较好!
还是有什么问题?
回复

使用道具 举报

lidq.jingwu 发表于 2009-10-20 11:28:50 | 显示全部楼层
竟然还有子查询,很浪费数据库资源的,将
select * from supe_hqitems a , supe_hqmessage b
where a.itemid=b.itemid and a.subject = (select subject from supe_hqitems where catid = 1 order by dateline desc limit 0,1) order by dateline desc
放到phpmyadmin中执行一次看能否运行成功。
回复

使用道具 举报

 楼主| 楼主骗子 发表于 2009-10-20 11:37:06 | 显示全部楼层
竟然还有子查询,很浪费数据库资源的,将
select * from supe_hqitems a , supe_hqmessage b
where a.ite ...
lidq.jingwu 发表于 2009-10-20 11:28



    我上面写了 在PHPADMIN上运行 是成功的
回复

使用道具 举报

guokun 发表于 2009-10-20 11:44:32 | 显示全部楼层
帮顶下  都是高深的问题
回复

使用道具 举报

lidq.jingwu 发表于 2009-10-20 12:16:21 | 显示全部楼层
3# 楼主骗子


    将sql语句改成下面的试一下:
select * from supe_hqitems a , supe_hqmessage b
where a.itemid=b.itemid and a.subject = (select subject from supe_hqitems where catid = 1 order by dateline desc limit 0,1)
回复

使用道具 举报

 楼主| 楼主骗子 发表于 2009-10-20 14:56:26 | 显示全部楼层
本帖最后由 楼主骗子 于 2009-10-20 14:58 编辑

SupeSite info: MySQL Query Error

User: xxx
Time: 2009-10-20 2:55pm
Script: /ss/index.php

SQL: SELECT * from [Table]hqitems a , [Table]hqmessage b
where a.itemid=b.itemid and a.subject = (select subject from [Table]hqitems where catid = 1 order by dateline desc LIMIT 0,20
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2
Errno.: 1064

还是不行啊!是不是 SS 不支持子查询啊
或者 这种 查询 还可以用什么方法来实现????
回复

使用道具 举报

 楼主| 楼主骗子 发表于 2009-10-20 14:56:59 | 显示全部楼层
是不是不支持子查询啊
回复

使用道具 举报

serverhz 发表于 2009-10-20 14:57:37 | 显示全部楼层
问下你的空间商啊~  是不是空间不支持。 这个服务都有的
回复

使用道具 举报

 楼主| 楼主骗子 发表于 2009-10-20 14:59:52 | 显示全部楼层
8# serverhz


    不太明白??你说的是什么服务?
回复

使用道具 举报

serverhz 发表于 2009-10-20 15:06:47 | 显示全部楼层
9# 楼主骗子


    数据库语句问题  .   找你的空间商啊,  我们的客户我们都是我们帮解决的。
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-14 21:05 , Processed in 0.100348 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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