• Is there any way to put a case statement within a join like this

    SELECT * FROM DESSERTS

    CASE WHEN ____ = ____ then

    JOIN someTable on x.TableName1 = desserts.TableName1

    When ____ = _____ then

    JOIN someTable on x.TableName2 = desserts.TableName2

    Else

    Join someTable on x.TableName3 = desserts.TableName3

    Sorry for the mulitple edits of this. For some reason the space bar was submitting it... Weird!!!

    So basically depending on a particular case I want to join a main table with a secondary table.

    Thanks