Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6689939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:34:41+00:00 2026-05-26T05:34:41+00:00

SELECT ERI.ATTACK_CASE_ID, LRM.REF_VALUE AS ATTACK_CASE_STATUS, WDR.RESTRICTION_NAME, LL.USER_LABEL AS ***RESTRICTION_STATUS***, WSRI.RESTRICTION_DATE, CASE NVL(ERI.IS_PRIMARY, 0) WHEN

  • 0
SELECT 
      ERI.ATTACK_CASE_ID, 
      LRM.REF_VALUE AS ATTACK_CASE_STATUS,
      WDR.RESTRICTION_NAME, 
    LL.USER_LABEL AS ***RESTRICTION_STATUS***,
     WSRI.RESTRICTION_DATE,
       CASE NVL(ERI.IS_PRIMARY, 0) WHEN 0 THEN 'No' ELSE CASE ERI.IS_PRIMARY WHEN 1 THEN 'Yes' ELSE 'No' END END AS PRIMARY
FROM ALERT A 
 LEFT OUTER JOIN ENTITY_RESTRICTION_INFO ERI ON A.ALERT_KEY=ERI.ENTITY_KEY
 LEFT OUTER JOIN LK_REFERENCE_MAPPING LRM ON LRM.REF_KEY= TO_CHAR(ERI.ATTACK_CASE_STATUS)
 LEFT OUTER JOIN LK_REFERENCE_CATEGORY LRG ON LRM.LK_REFERENCE_CATEGORY_ID = LRG.ID 
AND  LRG.CATEGORY_CODE = 'DD' 
AND LRG.SUB_CATEGORY_CODE='ATTACK_STATUS_ID_NAME'   
 LEFT OUTER JOIN WNORKOM_DD_RESTRICTION WDR ON ERI.RESTRICTION_ID=WDR.RESTRICTION_ID 
 LEFT OUTER JOIN WNORKOM_SAR_RESTRICT_INFO WSRI ON WSRI.RESTRICTION_ID=ERI.RESTRICTION_ID
 *LEFT OUTER JOIN LK_LOOKUPS LL ON LL.CODE=**WSRI.RESTRICTION_STATUS***
WHERE A.ALERT_KEY=121234 
AND ERI.ATTACK_CASE_ID='PP-123-0980'
AND LL.TYPE=9502

The above query returns me all the records when there is some value in WSRI.RESTRICTION_STATUS

However, it returns NO RECORDS when WSRI.RESTRICTION_STATUS = NULL.
What can I add/change in above query so that LL.USER_LABEL = ‘Unknown’ when WSRI.RESTRICTION_STATUS = NULL. For your information, there is no value ‘Unknown’ in LK_LOOKUPS table. This is something I want to return as an independent string when WSRI.RESTRICTION_STATUS = NULL. Adding a record to LK_LOOKUPS table with LL.CODE=NULL and LL.USER_LABEL=’Unknown’ can mess up things so please help me passing it independently in the query.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:34:42+00:00Added an answer on May 26, 2026 at 5:34 am

    It sounds you simply need to move the criteria LL.Type = 9502 into the Left Join and use Coalesce in the Select clause. Also, since you are applying criteria to a column in the Entity_Restriction_Info table from the Where clause, you have transformed the Left Join to this table into an Inner Join and thus, you might as well use an Inner Join.

    Select Eri.Attack_Case_Id
        , Lrm.Ref_Value As Attack_Case_Status
        , Wdr.Restriction_Name
        , Coalesce(LL.User_Label, 'Unknown') As Restriction_Status
        , Wsri.Restriction_Date
        , Case Nvl(Eri.Is_Primary, 0) 
            When 0 Then 'No' 
            Else Case Eri.Is_Primary 
                    When 1 Then 'Yes' 
                    Else 'No' 
                    End 
            End As Primary
    From Alert As A
        Inner Join Entity_Restriction_Info As Eri 
            On A.Alert_Key=Eri.Entity_Key
        Left Outer Join Lk_Reference_Mapping As Lrm 
            On Lrm.Ref_Key= To_Char(Eri.Attack_Case_Status)
        Left Outer Join Lk_Reference_Category As Lrg 
            On Lrm.Lk_Reference_Category_Id = Lrg.Id
                And  Lrg.Category_Code = 'Dd' 
                And Lrg.Sub_Category_Code='Attack_Status_Id_Name'   
        Left Outer Join Wnorkom_Dd_Restriction As Wdr 
            On Eri.Restriction_Id=Wdr.Restriction_Id 
        Left Outer Join Wnorkom_Sar_Restrict_Info As Wsri 
            On Wsri.Restriction_Id=Eri.Restriction_Id
        Left Outer Join Lk_Lookups As LL
            On LL.Code='Wsri.Restriction_Status'
                And LL.Type=9502
    Where A.Alert_Key=121234 
        And Eri.Attack_Case_Id='Pp-123-0980'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

SELECT Wot.WorkOrderType, COUNT(CASE WHEN Wo.Status = 'C' THEN 1 END) as [Completed], COUNT(CASE WHEN
SELECT COUNT(id), AgeRange FROM ( select id, case when age < 0 then 'less
select case when cntrctr_lcns_seq_no is null then 1 else max(cntrctr_lcns_seq_no) end as cntrctr_lcns_seq_no from
SELECT REPLACE([strUrl], '/myoldurl', '/mynewurl') FROM [UrlRewrite] If strUrl is /myoldurl/myoldurl_something_else , it returns /mynewurl/mynewurl_something_else
SELECT Id,Date,Name FROM people WHERE DATEPART(hh,Date) >= 7 AND DATEPART(hh,Date) <= 8 Order by
SELECT TB.ID, Latitude, Longitude, 111151.29341326 * SQRT( POW( -6 - `Latitude` , 2 )
select tf.Id,tf.Name,tf.LName,tf.Rank,tf.Category where tf.Id not in (select fighter_id from tbl_player_fighter where league_id=91) and tf.Status
SELECT * From `users` AS `User` LEFT JOIN `selections` AS `Selections` ON (`Selections`.`user_id` =
SELECT Dateadd(month, Datediff(month, 0, Getdate()), 0), 'First Day of Current Month' Can anyone tell
Select only showing first character of option text in IE 9 Using click on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.