I have this query:
x
select *
from COMMISSION
where dealer_id in (select dealer_id from DEALER where COM_NAME like 'abcdef')
This query returns two rows which include column STATUS_ID
with values 100, 102. I want to retrieve the row which has STA_ID = 102
. How do I do that? Please help.
Advertisement
Answer
select top 1 id
from Commission
where dealer_id in (select dealer_id from DEALER where COM_NAME like 'abcdef')
order by Status_ID desc