I'm trying to do a LEFT JOIN to a table that can contain multiple values that meet my criteria, but I only want to select one of them.
Table1
sId
123X
Table2
sId Type EDate xId
123x XX 8/19/2022 144
123x XX 8/19/2022 145
What I'm trying to achieve:
sId xId
123x 144
SELECT t1.sId, t2.xId
FROM table1 t1
LEFT JOIN table2 t2 ON t1.sId = t2.sId AND t2.Type='XX'