I want to select distinct vendor with chase if there are two vendor with status register and not register then the choosen one is vendor with status register but if only one vendor then just select it,
I'm using sql server 2017
SELECT pv.vendor_id,pv.vendor_name,'Not Registered' as registration_status FROM proposal_vendor as pv UNION SELECT bv.vendor_id,bv.vendor_name,bv.registration_status FROM bidding_vendor as bv WHERE bv.bidding_header_id = 97 48 vendor a Register 48 vendor a Not Registered 4110 vendor b Register 4110 vendor b Not Registered 4197 vendor c Not Registered what i'm expected is
48 vendor a Register 4110 vendor b Register 4197 vendor c Not Registered