I'm trying to join the output of two tables into one.
I have two tables with the following structure:
Table tb_LineStatus is:
LineNo, ParcelNo
1, 100
2, 0
3, 0
Table tb_SystemParamsSite is:
ParamName, ParamValue
ServerLine1, 1
ServerLine2, 1
ServerLine3, 0
My first select statement is (I'm only interested in Lines where the ParcelNo is 0):
SELECT [LineNo] FROM tb_LineStatus where ParcelNo = 0
This returns:
LineNo
2
3
My second statement is:
(SELECT row_number() OVER (ORDER BY ParamName) [LineNo],
CASE WHEN ParamValue = '1' THEN 'Live' ELSE 'Test' END AS Server
FROM tb_SystemParamsSite
WHERE ParamName like 'ServerLine%')
This returns:
LineNo, Server
1, Live
2, Live
3, Test
I'd like a Select statement that combines the two and returns the following:
LineNo, Server
2, Live
3, Test
Any help would be appreciated.