Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Need help in query

Author  Topic 

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-06-14 : 21:57:03
[code]SELECT CASE WHEN trx_type in('DO','CDO','DOL') then do_no, COALESCE(do_date, in_date) as in_date
WHEN trx_type in('INV','CS','CN','DN','POS','INC','CNC') then in_no as do_no, in_date END
FROM st_head
WHERE (do_date>='01/01/07' and do_date<='31/12/07') or (in_date>='01/01/07' and in_date<='31/12/07') [/code]
CASE WHEN condition allow multiple field??

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-14 : 22:00:57
Nope. Not allow. Use 2 case statement


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2009-06-14 : 22:01:58
T.T i was thinking to shorten the query, is there anyway works like mine query except 2 case statement?
Go to Top of Page
   

- Advertisement -