a way to compare sql bit to char in two different tables

You could enumerate the combinations. Say you want a match, then use the following condition:

(ta.a = 0 and tb.b = 'C') or (ta.a = 1 and tb.b = 'D')

Alternatively, use a case expression:

ta.a = case tb.b when 'C' then 0 when 'D' then 1 end

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top