錯誤記錄 資料庫 SQL,Mybatis的XML

2021-08-06 05:42:49 字數 765 閱讀 4896

1. 多表關聯查詢時(left join),主表一定是放在最前面(粗心)

2.mybatis中,關於if test多個條件

(1)and or 必須小寫,不識別大寫

(2)or 作用範圍的條件要加括號,for example:

test="begintime!=null and begintime!='' and (endtime == '' or endtime == null) ">     正確

test="begintime!=null and begintime!='' and endtime == '' or endtime == null">錯誤

test="(begintime==null or begintime=='' ) and (endtime == '' or endtime == null")>

正確   (3) if test多個條件是可以使用 choose  when otherwise 來代替,如下,時間過濾

and date(u.create_time) between # and curdate()

and date(u.create_time) <= #

and date(u.create_time) between # and #

(4) 在mysql時間過濾時,可以使用date(時間字段)將時間轉為『2017-12-31』這樣的格式來進行過濾

(5)sql中對某欄位是否為空進行過濾:

and if(ua.user_account is null,'否','是') = #

mysql更新資料錯誤記錄

update table set column1 column2 where 條件.我需要更新資料庫中的某個值,但是條件中的值需要使用子查詢查出來,按照這個更新語法,寫出了以下的語句 update fnd flex values set name 固定金額 description 固定金額 wher...

puppet 錯誤記錄

因為測試的需要把puppet master 給乾掉了,重新安裝puppet master,重新開始認證簽名。安裝好puppet master,什麼也不做,使用之前的client 連線master,會出現以下錯誤 warning peer certificate won t be verified i...

錯誤記錄(一)

時間限制 3000 ms 記憶體限制 65535 kb 難度 2 描述 編寫乙個c程式,實現兩個分數的加減法 輸入 輸入包含多行資料 每行資料是乙個字串,格式是 a boc d 其中a,b,c,d是乙個0 9的整數。o是運算子 或者 資料以eof結束 輸入資料保證合法 輸出對於輸入資料的每一行輸出兩...