conditional join in mysql

You can’t do it directly like that… you can do something like this though (not very pretty…): SELECT t.id, t.type, t2.id AS id2, t3.id AS id3 FROM t LEFT JOIN t2 ON t2.id = t.id AND t.type=”t2″ LEFT JOIN t3 ON t3.id = t.id AND t.type=”t3″

How to compare strings in C conditional preprocessor-directives

I don’t think there is a way to do variable length string comparisons completely in preprocessor directives. You could perhaps do the following though: #define USER_JACK 1 #define USER_QUEEN 2 #define USER USER_JACK #if USER == USER_JACK #define USER_VS USER_QUEEN #elif USER == USER_QUEEN #define USER_VS USER_JACK #endif Or you could refactor the code a … Read more