【mysql】[error]group-凯发k8官方网
凯发k8官方网
收集整理的这篇文章主要介绍了
【mysql】[error]group_concat造成的sql语法错误
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
sql错误实例
$sql_id = "select group_concat(`table_a_id`) from `table_b`"; $id_str = $db->execute($sql_id);$sql = "select * from `table_a` where `id` in ( {$id_str} ) and `is_effect` = 1`"; $res = $db->execute($sql);/* 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 ') and `is_effect` = 1' */ // 完整sql: select * from `table_a` where `id` in ( 1,2,3,4, ) and `is_effect` = 1`错误原因
sql中多了一个逗号
group_concat 执行结构有大小限制,会根据byte大小进行截取
参考:mysql手册-group_concat
总结
以上是凯发k8官方网为你收集整理的【mysql】[error]group_concat造成的sql语法错误的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇:
- 下一篇: java异常处理终结篇——如何进行jav