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 6147197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:04:14+00:00 2026-05-23T19:04:14+00:00

if @Status = ‘0’ and @Complaint<> ‘0’ WITH NewTable As ( Select sno =

  • 0
if
@Status = '0' and @Complaint<> '0'
WITH NewTable As
    (

        Select sno = ROW_NUMBER()OVER (order by complaint_id), Complaint_Id, Complaint.ComplaintType_id, Complaint.complaintProfileId, Complaint.Description, 
                            Complaint.Email, Complaint.PriorityLevel_id, Complaint.Date_Complained, Complaint.Status, Complaint.AdminComments, Complaint.Phone, Complaint.Evidence
                from Complaints Complaint ),

with two as 
if exists(select profile_id from MMBmembership
where profile_id = ComplaintProfileId)
select  MMB_Name as @Name from MMB_BusinessProfiles where MMBId= (select MMB_id from MMBMembership
where profile_id  = ComplaintProfileId )

if exists(select profile_id from UPPMembership
where profile_id = ComplaintProfileId)


set @Name = 'UPP'
else
set @name = 'Not Found'



SELECT * FROM NewTable,@Name   left outer join two on 
newtable.complaintProfileid = two.ProfileId 
WHERE (ComplaintType_id = @Complaint) ORDER BY Date_Complained desc ,PriorityLevel_id

Thanks
Sun
  • 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-23T19:04:14+00:00Added an answer on May 23, 2026 at 7:04 pm

    Unless I misunderstood I don’t think you need a SUB Query. You just need a LEFT JOIN, and yes you can use a CASE statement

     SELECT  
          CASE 
               WHEN MMB_Name IS NOT NULL THEN MMB_Name  
               WHEN UPPMembership.profile_id  IS NOT NULL THEN 'UPP'
               ELSE 'Not found'
          END as Name
      FROM Complaints Complaint
         LEFT JOIN  MMBMembership 
         ON MMBMembership.profile_id = Complaint.complaintProfileId
         LEFT JOIN UPPMembership
         ON UPPMembership.profile_id = Complaint.complaintProfileId
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HTTP Status 404 - /JspTest1/ type Status report message /Projectname/ description The requested resource
I added a gps status listener to my location manager in order see when
Status Time Handel Title --------- ------------ ------ ------------- CREATED 2009-10-16 03:37:38+01 902D8 Mozilla Firefox
git status tells me that my branch and the one I started from on
Array ( [status] => success [stories] => Array ( [0] => Array ( [name]
I have a Status class in C#, used like this: Status MyFunction() { if(...)
I have a Monthly Status database view I need to build a report based
What's the current status of Mono 's Platform Invoke implementation on Linux and on
I have a status message box (div box) positioned at the bottom of a
What is the current status of GUI programming with D Language? Are the language

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.