如果Null:否,选择查询将不显示结果

时间:2018-12-02 11:29:46

标签: mysql

我有以下查询:

select 
  if(Account.disabled >0,'Disable','Enable ') as 'Account Status',
  Account.name as Account,homeFolder as 'Home Folder', 
  TransferConfiguration.transferTag as 'Transfer Method', 
  Site.name as 'Site name',
  Application.type as 'Application Type', 
  Application.name as 'Application name', 
  Subscription.folder as 'Subscription Folder' 
from 
  Account,
  TransferConfiguration,
  Site,
  Application,
  Subscription 
where 
  (TransferConfiguration.siteId=Site.id) And 
  (Site.accountId=Account.id) And 
  (Subscription.applicationId=Application.id) and 
  (TransferConfiguration.subscriptionId=Subscription.id) 
UNION ALL select 
  if(Account.disabled >0,'Disable','Enable ') as 'Account Status',
  Account.name as Account,
  homeFolder as 'Home Folder' 
from 
  Account 
ORDER BY 
  Account.name asc

尽管我尝试从数据库中导出一些数据,但是在“站点名称”没有值(例如,该帐户没有分配任何站点名称)的情况下,而不是将结果返回为:

| Enable         | User1    | file:/home/Zack/   | PARTNER-IN      |       ?!?| SharedFolder     | test             | /test               
| Enable         | User2  | file:/home/Zlatko/ | PARTNER-OUT     | YESYESYES  | Basic            | yolo             | /test2               |

哪里?!?应该只是一个空白空间,相反,我只看到第二行:

| Enable         | User2  | file:/home/Zlatko/ | PARTNER-OUT     | YESYESYES  | Basic            | yolo             | /test2               |

知道我缺少什么吗?

0 个答案:

没有答案