Hi,
From below tables I would to like to write TSQL query to get the below results, please help on it.
IF OBJECT_ID('tempdb..#NetWorthAnticipated') IS NOT NULL
DROP TABLE #NetWorthAnticipated;
SELECT *
INTO #NetWorthAnticipated
FROM
(
VALUES
(0, 25000),
(25001, 50000),
(50001, 200000),
(200001, 500000),
(500001, 1000000),
(1000001, 3000000),
(3000001, 100000000)
) AS a (MinRange, MaxRange);
IF OBJECT_ID('tempdb..#Networth') IS NOT NULL
DROP TABLE #Networth;
SELECT *
INTO #Networth
FROM
(VALUES
( '$25,000 and under' ),
( '$1,000,001 - $3,000,000' ),
( '$200,001 - $500,000' ),
( '$25000 - $50000' ),
( '$500,001 - $1,000,000' ),
( '$50,001 - $200,000' ),
( '$50,001-200,000' )
) AS b (NetWorth);
SELECT FROM #Networth
SELECT FROM #NetWorthAnticipated
From the above tables need the below Results :
Thank you for the reply, That's what the task actually, I tried by using cast function which includes Rank function but still not able to find the above results.
Could you please suggest anyway to do it by TSQL ?
And please avoid double posts.
https://learn.microsoft.com/en-us/answers/questions/700644/help-on-tsql-query.html