久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

mysql - 這條聯合sql語句哪里錯了

瀏覽:173日期:2022-06-14 14:53:26

問題描述

((( SELECT a.log_id,`create_date`,`content`,`creator`,`belong_to_user`,a.customer_code,`follow_up_way` FROM gs_log a left join gs_customer b on a.customer_code = b.customer_code WHERE ( b.customer_code != ’’ AND b.customer_id = 2212 ) )) union (( SELECT a.log_id,`create_date`,`content`,`creator`,`belong_to_user`,`customer_code`,`follow_up_way` FROM gs_log a left join gs_r_customer_log on a.log_id = gs_r_customer_log.log_id WHERE ( gs_r_customer_log.customer_id= 2212 ) ))) limit 0,10

這條語句哪里錯了,半天沒找到,錯誤提示

[SQL]((( SELECT a.log_id,`create_date`,`content`,`creator`,`belong_to_user`,a.customer_code,`follow_up_way` FROM gs_log a left join gs_customer b on a.customer_code = b.customer_code WHERE ( b.customer_code != ’’ AND b.customer_id = 2212 ) )) union (( SELECT a.log_id,`create_date`,`content`,`creator`,`belong_to_user`,`customer_code`,`follow_up_way` FROM gs_log a left join gs_r_customer_log on a.log_id = gs_r_customer_log.log_id WHERE ( gs_r_customer_log.customer_id= 2212 ) ))) limit 0,10[Err] 1064 - 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 ’union (( SELECT a.log_id,`create_date`,`content`,`creator`,`belong_to_user`,`cus’ at line 3

問題解答

回答1:

你括號加太多了,相當于最外面那層是(...) limit 0,10,只能是(...) union (...) limit 0,10

(( SELECT a.log_id,`create_date`,`content`,`creator`,`belong_to_user`,a.customer_code,`follow_up_way` FROM gs_log a left join gs_customer b on a.customer_code = b.customer_code WHERE ( b.customer_code != ’’ AND b.customer_id = 2212 ) )) union (( SELECT a.log_id,`create_date`,`content`,`creator`,`belong_to_user`,`customer_code`,`follow_up_way` FROM gs_log a left join gs_r_customer_log on a.log_id = gs_r_customer_log.log_id WHERE ( gs_r_customer_log.customer_id= 2212 ) )) limit 0,10回答2:

a.log_id

回答3:

建議分步排查。

不知道誰選的答案沒幫助?分步排查的意思是將大的SQL語句拆分為多個小SQL語句排查。估計是他沒有領悟到。

相關文章:
主站蜘蛛池模板: 景德镇市| 湘潭县| 融水| 清水县| 裕民县| 乌苏市| 天全县| 泰安市| 朝阳区| 曲松县| 小金县| 石首市| 阿拉尔市| 临安市| 扎囊县| 湟中县| 诸暨市| 阿勒泰市| 长沙县| 萨嘎县| 藁城市| 微山县| 尤溪县| 万盛区| 固原市| 吉木乃县| 岳普湖县| 治多县| 华阴市| 镇雄县| 郁南县| 五华县| 乐陵市| 太康县| 靖宇县| 东乌| 胶南市| 石河子市| 始兴县| 安新县| 石阡县|