SELECT qd.new_capid, qd.new_captype,
cv.*
FROM quotedetailextensionbase qd
LEFT JOIN new_capvehicleextensionbase cv
ON qd.new_capid = cv.new_capid
AND qd.new_captype = cv.new_type
A pretty straightforward join, except the last line
AND qd.new_captype = cv.new_type
qd.new_captype is varchar and can either be "car" or "van" cv.new_type is int and can either be 1 or 2
car = 1 van = 2
Is there some way I could "translate" one to the other to do the join?
Thanks