读书人

使用mysql limit时有关问题()

发布时间: 2012-01-07 21:41:55 作者: rapoo

使用mysql limit时问题(在线等)
select * from jsp_ttt where jsp_forum= '3 ' limit 0,50

当select 中没有数据使用limit就会出错,怎么解决?




[解决办法]
先判断select中是否有值

if exists( select * from jsp_ttt where jsp_forum= "3 " )
begin
select * from jsp_ttt where jsp_forum= "3 " limit 0,50
end
else
begin
print 'select中没有值'
end
[解决办法]
1\
select * from jsp_ttt where jsp_forum= "3 " limit 0,50
---------------
我看好象没有问题,你在Front工具里调试一下,看报什么错.

2\
----------------------------------------------
先判断select中是否有值

if exists( select * from jsp_ttt where jsp_forum= "3 " )
begin
select * from jsp_ttt where jsp_forum= "3 " limit 0,50
end
else
begin
print 'select中没有值 '
end
----------------------------------------------
不需要这么做,limit实际上在MySQL中相当于SQL中的TOP,所以.......

[解决办法]
可以用isnull(( select * from jsp_ttt where jsp_forum= "3 " limit 0,50 ),'空')
[解决办法]
你的mysql 3以前的?

读书人网 >asp.net

热点推荐