mysql的條件語句 mysql條件語句

2021-10-17 12:12:14 字數 1355 閱讀 2925

and((c.shouli_sj>1288945672andc.diaochaqingkuangisnull)or(c.shouli_sj<1288945672andc.diaochaqingkuangisnull)or(c.diaochaqingkuang!=''))這塊有問題該怎麼改?selectc.*,u.name...

and ((c.shouli_sj >1288945672and c.diaochaqingkuang is null) or ( c.shouli_sj<1288945672and c.diaochaqingkuang is null ) or (c.diaochaqingkuang != '' ))

這塊有問題該怎麼改?

select c . * , u.name as terminal_name, r.region_name, ur.region_name as area_name

from complain c

left join user u on u.id = c.shouliren

left join region r on r.region_id = u.region_id

left join region ur on r.parent_id = ur.region_id

where 1 =1

and c.chulibumen

in ( 1, 2 )

and (

c.shouli_sj >1288945672

and c.diaochaqingkuang is null

) or ( c.shouli_sj <1288945672

and c.diaochaqingkuang is null ) or ( c.diaochaqingkuang != '' )

and c.to_time >= '1277942400'

and c.to_time <= '1289001599'

order by c.shouli_sj desc

limit 0 , 30

我的意思是說包含上面那個語句的下面那一大段出錯了,具體是什麼錯誤我找不到,請大家幫忙,感謝!

這段東西不報錯,就是查不出東西,資料庫裡確實有東西

這樣能查出來

and ((c.diaochaqingkuang != '' ))

加了or後變成下面那樣就沒有資料了

and ((c.shouli_sj >1288945672 and c.diaochaqingkuang is null) or ( c.shouli_sj<1288945672 and c.diaochaqingkuang is null ) or (c.diaochaqingkuang != '' ))

展開

mysql的條件語句 MySQL條件語句

好的,所以我有乙個如下所示的查詢 select orders group concat concat menu items name format menu items price 2 separator as items sum menu items price as additional chi...

mysql語句條件篩選 MySQL 條件查詢

語法 執行順序 312 select 查詢列表 from 表名where 篩選條件 分類 按條件表示式篩選 條件運算子 按邏輯表示式篩選 邏輯運算子 用於連線條件表示式 和and 兩個條件都為true,結果為true,反之為false 和or 只要有乙個條件為true,結果為true,反之為fals...

mysql 語句 條件查詢

高階2 條件查詢 語法 select 查詢列表 from 表名where 篩選條件 分類 一 按條件表示式篩選 簡單條件運算子 二 按邏輯表示式篩選 邏輯運算子 作用 用於連線條件表示式 and or not 和and 兩個條件都為true,結果為true,反之為false 或or 只要有乙個條件為...