SQL Oracle:用单词替换空结果 [英] SQL Oracle: Replace an empty result with word

查看:100
本文介绍了SQL Oracle:用单词替换空结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理这个问题几天.我有一个 oracle 数据库. 必须通过一个查询解决该问题.没有功能,姿势,... 我要选择.当他有结果时,将其发布.否则应该有空结果".

I'm working on this problem for several days. I have a oracle database. The problem must be resolved in one query. No Function, Pocedure, ... I want to make a select. When he has results, post them. Else there should be "empty result".

select case 
when count(*) = 0    
then 'no Entry'   
else MAX(Member)--all Members should be here 
END as Member 
from tableMember 
where Membergroup = 'testgroup'; 

问题是Oracle希望else拥有Agregat函数.因此,如果结果不是"no entry",我只会得到一个值.我需要所有值.

The problem is that Oracle wants an Agregat function by the else. So I only get one value if the result is not "no entry". I need all values.

欢迎能够帮助我的每个人,并让我感到高兴.

Everybody who can help me is welcome and makes me happy.

推荐答案

不确定您要达到什么目标,也许是这样

not sure what do you try to achieve, perhaps this

 select member from tablemember where Membergroup = 'testgroup'
union 
 select  'no Entry' 
 from dual 
 where NOT EXISTS ( select member from tablemember where membergroup = 'testgroup')
;

这篇关于SQL Oracle:用单词替换空结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆