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.
| Author |
Topic |
|
SP273
Starting Member
14 Posts |
Posted - 2011-04-06 : 10:09:22
|
| Hi,I have the following query:SELECT DISTINCT Accounts, Account_Oracle, Account_Desc, Child, CASE Account_Oracle WHEN NULL THEN Child ELSE Account_Oracle END AS MappingFROM dbo.HS_Data_Jan_ProjPlan LEFT OUTER JOIN dbo.Solo_AccCat_Conv ON Accounts = 'P_'+AccCat_Solomon LEFT OUTER JOIN dbo.HS_Accounts_PR_Hierarchy ON Accounts = ChildIn the mapping column created i don't get the value of child when account_oracle is null , what i get is only account_oracle & all child entries are NULL can somebody please let me know that in mapping how can i populate both child & account_oracle values.Thanks! |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-04-06 : 10:14:02
|
COALESCE(Account_Oracle,Child) as Mappingbut then Child must be reliable not null.orISNULL(Account_Oracle,Child) as Mapping No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
SP273
Starting Member
14 Posts |
Posted - 2011-04-06 : 10:17:54
|
quote: Originally posted by webfred COALESCE(Account_Oracle,Child) as Mappingbut then Child must be reliable not null.orISNULL(Account_Oracle,Child) as Mapping No, you're never too old to Yak'n'Roll if you're too young to die.
|
 |
|
|
SP273
Starting Member
14 Posts |
Posted - 2011-04-06 : 10:20:09
|
| Hi,Thanks for your reply. ISNULL worked fine. Now for all the NULL that i get in the mapping column i want to add a text 'delete' instead of NULL. Is there a way to do it?Thanks' |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-04-06 : 13:12:15
|
ISNULL(YourCharacterColumn,'delete') No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|