我有表字段update_它可以有空,一些價值版本具有null以及價值得到值..如何從數據庫中單個查詢
Select * from Employee where employee_id = '1234' and updated_version is null
Select * from Employee where employee_id = '1234' and updated_version ='1'
我要兩個查詢組合
我已經嘗試過,但沒有工作。
Select * from Employee
where employee_id = '1234'
and updated_version = (select case when updated_version is null
then NULL
else updated_version
end)
注:我西港島線得到員工ID和updated_version輸入來自其他表
很抱歉的混亂。更新後的版本值不僅爲1,並且爲空。它可以是我從另一張桌子上得到的任何值。所以,我從其他表獲得什麼價值,我必須用Employee表中的條件查詢,以獲得適當的結果。並非全部結果。
你試過Parado說的嗎? –
顯示您的輸出表結構。 –