2014-06-06 35 views

回答

0

您可以使用case

select Machine_Code 
    , Machine_Name 
    , (case when Status = 1 then 'active' else 'not active' end) as Status 
from Machine_Master 
where '" & combolinecode.Text & "' = Line_Code 
1

您可以在幾乎所有的數據庫與ANSI標準case語句來做到這一點:

select Machine_Code, Machine_Name, 
     (case when Status = 1 then 'active' else 'not active' end) as status 
from Machine_Master 
where '" & combolinecode.Text & "' = Line_Code"; 

我擔心,如果你正在使用VBA,你可能會使用訪問,它有自己的方式:

select Machine_Code, Machine_Name, 
     iif(Status = 1, "active", "not active") as status 
from Machine_Master 
where '" & combolinecode.Text & "' = Line_Code"; 
+0

感謝您的幫助,這對我有很大的幫助.... – user3713568