I am working with a data set where I needed to pull it certain values from the same column of data, but place them into two different columns
Example
> OrderID ProductID PRODNAME NORECIP PPRECIP ITEMTTL MD SRE POST
14764 2306 DW14RE_FC 187 $1.85 $345.95 10/29/20 NULL FC
14935 2341 DW14RE_STD 205 $1.00 $205.00 11/5/20 No STD
14977 2343 DW14RE_UP_FC 439 $1.00 $439.00 11/5/20 No NULL
15072 2341 DW14RE_STD 3220 $1.00 $3,220.00. 11/11/20 No STD
The SRE Column and POST columns both have a RIGHT JOIN as shown below
RIGHT JOIN [uStore].[dbo].[OrderProductDialValue] AS OPDV1 ON
OPDV1.[OrderProductID] =
[uStore].[dbo].[OrderProduct].[OrderProductID] AND OPDV1.[DIALID] IN
('14479', '14480', '14481', '14482', '14483', '14950', '14972',
'14993', '15022', '15030', '15039', '15055', '15089', '15096',
'15155', '15163', '15192', '15217', '15241', '15261', '15279',
'15298', '15317', '15334', '15349', '15365', '15381', '15402',
'15425', '15449', '15473', '15497')
RIGHT JOIN [uStore].[dbo].[OrderProductDialValue] AS OPDV ON
OPDV.[OrderProductID] = [uStore].[dbo].[OrderProduct].[OrderProductID]
AND OPDV.DIALID IN ('14885', '14949', '14971', '14998', '15021',
'15029', '15088', '15095', '15132', '15162', '15191', '15216',
'15240', '15260', '15278', '15297', '15316', '15333', '15424',
'15448', '15472', '15496')
With the above in place, I drop my NULL values from the last two columns
> OrderID ProductID PRODNAME NORECIP PPRECIP ITEMTTL MD SRE POST
14935 2341 DW14RE_STD 205 $1.00 $205.00 11/5/20 No STD
15072 2341 DW14RE_STD 3220 $1.00 $3,220.00. 11/11/20 No STD
Is there any way have my selection of only those criteria listed in my RIGHT JOIN
but allow for NULL
values if it doesn't match those criteria to ensure I get my full data set?