Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In statement inside Case Statement

Status
Not open for further replies.

FunkyBunch

Instructor
Sep 11, 2007
35
CA
Hello All,

I am currently creating a view and was wondering if it was possible to use an in statement within a case statement. Here is my current SQL:
************************************************************
select access_equip_Fw,
case
when (date_mounted_Equipment_removed_fw is null) and (in (select count(access_equip_fw)
from user_Defined20_Fw group by access_equip_fw having count(access_equip_fw)>1)) then 'Transfer'

when Date_mounted_equipment_removed_fw is not null and (in (select count(access_equip_fw)
from user_Defined20_Fw group by access_equip_fw having count(access_equip_fw)>1)) then 'Transfer'

when Date_Mounted_equipment_removed_fw is null and (in (select count(access_equip_fw)
from user_Defined20_Fw group by access_equip_fw having count(access_equip_fw)=1)) then 'Addition'
When (Archive_status_fw = 'A') then 'Deletion'

Else ''
end AS sg
from user_Defined20_fw
group by date_mounted_equipment_removed_fw, access_equip_Fw, archive_status_fw

***********************************************************

The select sub-querys do return more than one value, but that should be ok within an IN statement.

Thanks,
 
Nevermind, I guess I would have to give supply a field to be in the sun-query. :&

Thanks,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top