2013-02-11 104 views
2

我可以在MySQL查詢由虛領域,如虛MySQL的領域

Select permission, value 
from permissions 

那裏沒有permission領域,但我希望分配true它。

+1

沒錯,'選擇true AS權限,...'。 – halfer 2013-02-11 12:03:23

回答

2
SELECT 'true' permission, value 
FROM permissions 

將返回一個字符串值 或

SELECT 1 permission, value 
FROM permissions 

SELECT true permission, value -- which is equivalent to 1 
FROM permissions 
1

你必須給你的想象領域的名稱,然後您可以將值分配給它。 比如name是permission,價值true

Select true as permission, ... 
from permissions 
1

嘗試:

SELECT "true" AS permission, value from permissions