我需要在SQL查询中使用带有IN函数的UPPER函数,任何人都能告诉我我做错了什么吗?我也在使用COUNT函数,这可能使事情复杂化:S
SELECT pepp.employee_number||'|'||pepp.full_name||'|'||pepp.person_id||'|'||cnt.cn Counted
FROM apps.per_all_people_f pepp
, (SELECT Count (person_id)CN, Upper (full_name) full_name
FROM apps.per_all_people_f pepp
WHERE 1=1
AND SYSDATE BETWEEN effective_STArt_date AND effective_end_date
group BY Upper (full_name)
ORDER BY Count (person_id) DESC, full_name) CNT
WHERE 1=1
AND SYSDATE BETWEEN pepp.effective_start_date AND pepp.effective_end_date
AND Upper (pepp.full_name) = cnt.full_name
and Upper (pepp.full_name) IN UPPER('Bloggs, Mr. Joe',
'Name, Ms. Anne');
适用于单个名称,但不适用于2个或更多......
任何帮助都会受到赞赏.....
答案 0 :(得分:5)
试试这个
IN (UPPER('Bloggs, Mr. Joe'),UPPER('Name, Ms. Anne'))
未经测试,但我非常确定这是正确的语法
答案 1 :(得分:1)
尝试改变: -
UPPER('Bloggs, Mr. Joe','Name, Ms. Anne') into
(Upper('Bloggs, Mr. Joe'),Upper('Name, Ms. Anne'));