troubleshooting Question

How can i write a case within the case statement for finding the string value for a below scenario

Avatar of srionline2k6
srionline2k6Flag for United States of America asked on
Microsoft SQL ServerOracle DatabaseSQL
22 Comments1 Solution470 ViewsLast Modified:
Activity tableHow can i write a case statement for the following scenario. Please guide me or give an idea

We need to populate Activity_info column.

For populating the column, we need to consider few things which i am mentioning in here.

First  Search for the values 'Paid search click' , 'Banner ad click' , "Email click' in the Activity column

Lets say For the Corresponding recording for "Paid search click" We have the Entry_id value as 1711 ; We need to search for that particular value "1711" in the entire column.
In the above we have 2 cases of same Log_Entry_ID with value "1711" but we need to look for only  "CAMP" value that exists in the ACT_CD for one of the 1711 value and get the corresponding value from ACT_TXT (in here we have "Search") and needs to populate it into Activity_info column for that related record.

That means Activity_info should be equal to ACT_TXT WHERE we need to satisfy the above condition.

Same is the case with "Banner AD Click" the value is 1752 for Entry_ID as we have two same values for entry_id we need to look For Selected_Activity_CD = "CAMP", Activity Info will be Selected_Activity_Tx here it is "s3k265"

In the above 2 cases of same Log_Entry_ID, when Activity is in either of Banner Ad Click, Paid Search Click or Email Click                                    
For Selected_Activity_CD = "CAMP", Activity Info will be Selected_Activity_Tx

How can i write a case statement. ?
Please guide me.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 22 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros