社区
MySQL
帖子详情
mysql limit 后不能跟表达式吗?
xnandjr
2007-07-26 07:43:07
我的表达式如下:
select case perName when "" then "" else "" end as temp from Info_PersonInfo limit 0,(13-10)
但老是提示 limit 后表达式有错误
...全文
996
2
打赏
收藏
mysql limit 后不能跟表达式吗?
我的表达式如下: select case perName when "" then "" else "" end as temp from Info_PersonInfo limit 0,(13-10) 但老是提示 limit 后表达式有错误
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
klan
2007-07-27
打赏
举报
回复
try:
set @a=13-10;
set @sql=concat('select case perName when "" then "" else "" end as temp from Info_PersonInfo limit 0, ', @a);
prepare sqlstmt from @sql;
EXECUTE sqlstmt;
懒得去死
2007-07-27
打赏
举报
回复
不能有。
mysql
limit
用法跟
表达式
_
mysql
limit
和offset用法
limit
和offset用法
mysql
里分页一般用
limit
来实现1. select* from article
LIMIT
1,32.select * from article
LIMIT
3 OFFSET 1上面两种写法都表示取2,3,4三条条数据当
limit
后面跟两个参数的时候,第一个数表示要跳过的数量,后一位表示要取的数量,例如select* from article
LIMIT
1,3 ...
limit
中 使用事项
不能
使用
表达式
避免踩坑
limit
中
不能
使用
表达式
mysql
> select * from t_order where
limit
1,4+1; ERROR 1064 (42000): 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 '
limit
1,4+1' at line 1
mysql
> s
Mysql
分页查询
limit
不能
使用运算符
mysql
limit
不能
使用运算符 进行分页查询的时候,如果写成以下sql,语句执行会报错: select * from user where id = 123456 and code = 111 and create_date >= 20190101 and create_date <= 20190202
limit
(1 - 1) * 1, 20 因为
mysql
中
limit
...
mysql
中
limit
后面
不能
使用运算符
mysql
中
limit
后面
不能
使用运算符 进行分页查询的时候,如果写成以下sql,语句执行会报错: select * from user where id = 123456 and code = 111 and create_date >= 20190101 and create_date <= 20190202
limit
(1 - 1) * 1, 20 因为
mysql
中
limit
后面
不能
带运算符,只能是常量。 解决方法 使用concat,动态sql。 set @sql
Mysql
中
limit
不能
使用运算符
mysql
中
limit
后面
不能
使用运算符: 进行分页查询的时候,如果写成以下sql,语句执行会报错: select * from user where id = 123456 and code = 111 and create_date >= 20190101 and create_date <= 20190202
limit
(1 - 1) * 1, 20 因为
mysql
中
limit
后面
不能
带运算符,只能是常量。 解决方法:使用concat,动态sql。 set @sql =
MySQL
56,865
社区成员
56,753
社区内容
发帖
与我相关
我的任务
MySQL
MySQL相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MySQL相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章