Sql語句錯誤 Unknown column xxx in where clause
Sql語句錯誤
但凡寫過sql語句的人估計都曾經碰到過類似於Unknown column ‘xxx’ in ‘where clause’的問題。 單從字面理解,我們很容易得出
列名不存在的結論,但是,很多時候起始並不是由於列名出錯造成的。而是由於拼湊sql語句時對字元型別資料沒有用引號引起來造成的。
sql中如果id是整型的倒不會出現什麼錯誤,但是如果sql中出現username等字串型別必須要包含在引號內。
所以修改hql為:final String hql = “from user
where username=”%榮%”
則錯誤消失。
這條sql語句改為: select * from user
**注意:** 查詢的後邊如果是字串型別,用 " " 雙引號括住,否則就容易出
下邊報的 Unknown column “%xxx%” in ‘where clause’ 該列 不存在的錯誤.
相關推薦
Sql語句錯誤 Unknown column xxx in where clause
Sql語句錯誤 但凡寫過sql語句的人估計都曾經碰到過類似於Unknown column ‘xxx’ in ‘where clause’的問題。 單從字面理解,我們很容易得出 列名不存在的結論,但是,很多時候起始並不是由於列名出錯造成的。而是由於拼湊sq
python操作資料庫出現錯誤 : Unknown column 'XXXX' in 'where clause'")錯誤
今天練習的時候,出現了這種坑爹的錯誤,找了好久,終於知道錯誤原因了,貼出修改的地方 在MySQL資料庫中存在中文的字元,python操作資料庫的語句如下 sql = "select * from t
MySql報錯原因分析Unknown column ‘xxx’ in ‘where clause’
在更新資料庫時曾經碰到過類似於Unknown column ‘xxx’ in ‘where clause’的問題。 單從字面理解,我們很容易得出列名不存在的結論,但是,很多時候起始並不是由於列名出
TP 框架解決Unknown column 'XXX' in 'where clause' 問題
最近在使用TP框架開發公司網站,遇到了一個問題Unknown column 'XXX' in 'where clause'的問題。這個問題最初查詢使用者的個人資訊,分別通過使用者的手機號和郵箱查詢:1.手機號查詢$mobile = (string)'手機號XXX';$user
Unknown column 'rownum' in 'where clause'解決方案
Unknown column 'rownum' in 'where clause',當在巢狀的查詢語句裡面用到rownum的時候會遇到這個問題,比如: SELECT * FROM (select t.id,t.name from USER_INFO t where t.s
java開發常遇錯誤:Column 'AAA' in where clause is ambiguous解決辦法
當在java開發中遇到了Column ‘AAA’ in where clause is ambiguous問題時,你需要去看看:多表查詢的時候不同的表是否出現了相同名稱相同的列,如果存在,你需要在條件中或者查詢結果中指定表名比如:user表有name,post表
Unknown column 'xxx' in 'field list'
MySQL資料庫插入資料時,出現Unknown column 'XXX' in 'field list' 問題('XXX'表示任意字元)。例如下面: 先建立一個數據庫:CREATE TABLE `p
連線查詢 Error:Column 'XXX' in order clause is ambiguous
錯誤為: Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'XXX' in order clause is ambiguous↵ ### T
MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous ;
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'ID' in where clause is ambiguous; SQL []; Colu
mysql Column 'dbvalue' in where clause is ambiguous解決方案
在一次使用mysql資料庫查詢的時候出現錯誤提示 Column 'languageid' in where clause is ambiguous,這個錯誤in where clause is amb
mysql下出現Unknown column 'id' in 'on clause'的解決方法
select vinfo.vid_id, vid_name, vid_leadrole, vid_desc, vid_director, vid_date, vid_area, vid_pic, vid_score, vid_info, vinfo.cid, vid_ser
MySQL 1054錯誤 Unknown column .... in 'on clause'
提示:ERROR 1054 (42S22): Unknown column ... in 'on clause'原因:MySQL5.0 Bug, 要把聯合的表用括號包含起來才行:例:Sql程式碼 SELECT (c.id, a.id, b.id) FROM A a, B b
mybaits錯誤 MySQLIntegrityConstraintViolationException: Column 'name' in where clause is ambiguous
dispatch tin lse rep thread sta RoCE .data cti 五月 06, 2019 1:50:36 上午 org.apache.catalina.core.StandardWrapperValve invoke嚴重: Servlet.ser
mysql錯誤:Column ‘id’ in field list is ambiguous
原因:從join的表中進行select時,兩個表都有id屬性,列’ID’在欄位列表中重複,其實就是兩張表有相同的欄位,但是使用時表字段的名稱前沒有加表名,導致指代不明,前面加上字首“表名”就沒問題了。 SELECT a.* FROM d
遷移檔案是報錯 django.db.utils.InternalError: (1054, "Unknown column 'name' in 'django_content_type'")
相信大家在做django遷移時有可能會遇到這樣的錯誤- django.db.utils.InternalError: (1054, “Unknown column ‘name’ in ‘django_content_type’”) 這個也是我遇到過得問題,
Unknown column 'name' in 'field list' 的小坑
在 使用mybatis對資料庫資料進行修改的時候出現瞭如下錯誤: org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: com.mysql.jdbc.
SQL語句:left join後面加上where條件
select a.*,b.* from table1 a left join table2 b on b.X=a.X where XXX 如上SQL:一旦使用了left join,沒有where條件時,左表table1會顯示全部內容 而使用了where,只有滿足where條
MySQL5.7更改密碼時出現ERROR 1054 (42S22): Unknown column 'password' in 'field list'
新安裝的MySQL5.7,登入時提示密碼錯誤,安裝的時候並沒有更改密碼,後來通過免密碼登入的方式更改密碼,輸入update mysql.user set password=password('root') where
SQLSTATE[42S22]: Column not found: 1054 Unknown column '1' in 'field list' -- IF查詢出錯
mysql IF() 查詢的時候出現這個錯誤 場景: user表 age欄位,查詢並輸出欄位 is_adult (0表示未成年,1表示已成年) 查詢語句如下: SELECT IF( age&g
SQL語句Left join 中On和Where的用法區別
如果SQL用的是Left Join ,On後面的條件對Left的表沒有作用,只對Right的表有過濾作用,Where語句可以對Left的表有過濾作用 如果SQL用的是Right Join ,On後面的條件對Right的表沒有作用,只對Left的表有過濾作用,Where