摘要:錯(cuò)誤實(shí)例完整錯(cuò)誤原因中多了一個(gè)逗號(hào)執(zhí)行結(jié)構(gòu)有大小限制,會(huì)根據(jù)大小進(jìn)行截取參考手冊(cè)
sql錯(cuò)誤實(shí)例
$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`錯(cuò)誤原因
sql中多了一個(gè)逗號(hào)
group_concat 執(zhí)行結(jié)構(gòu)有大小限制,會(huì)根據(jù)byte大小進(jìn)行截取
參考:mysql手冊(cè)-group_concat
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.hztianpu.com/yun/30436.html
閱讀 1486·2021-10-11 10:59
閱讀 3179·2019-08-30 15:54
閱讀 2815·2019-08-30 13:19
閱讀 2518·2019-08-30 13:02
閱讀 2437·2019-08-30 10:57
閱讀 3399·2019-08-29 15:40
閱讀 1048·2019-08-29 15:39
閱讀 2391·2019-08-29 12:40