JoNTSQLSrv (6/25/2016)
J Livingston SQL (6/25/2016)
maybe.....???
WITH cte as (
SELECT s.SellerID,
MAX(c.Mincredit) AS mc
FROM Seller_Table AS s
LEFT OUTER JOIN Credit_Mater AS c ON s.TotalcreditEarned >= c.Mincredit
GROUP BY s.SellerID
)
-- if these are the results you require then alter following code to UPDATE statement
SELECT cte.SellerID,
c.Title
FROM cte
INNER JOIN Credit_Mater c ON cte.mc = c.Mincredit;
Thanks 'J Livingston SQL' but is this correct ? wil this work in all the situation scenario? how to bring "Not eligible" along with this result?
but reallly i appreciate your thinking capacity.
I was actually trying to use while loop : passing all the totalcredit and check in whic title they will come .. but its really hard Guru
SELECT cte.SellerID,
ISNULL(c.Title,'Non Eligible')
FROM cte
LEFT JOIN Credit_Mater c ON cte.mc = c.Mincredit;
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day