Based on the Company_id I need to either Inner Join or skip an Inner Join (no join at all). If the Company_id is 999999999 I don't want to Inner Join to the Division table but if it is anything else I do.
I am new to SQL and I haven't seen any examples of this type of join statement. Would it be a CASE statement of some kind?
CASE When Company_id=999999999 THEN Inner Join Division on oh.Company_id = division.Company_id and oh.Division_id = division.Division_id ELSE 1=1 END