https://www.icyphoenix.com/viewtopic.php?f=26&t=8358&p=55132#p55132
-----------------------------------
Informpro
Sat 04 Feb, 2012 00:12

Re: Exclude Banned Calendar Bdays?
-----------------------------------
$sql = 'SELECT user_id, username, user_colour, user_birthday 
                FROM ' . USERS_TABLE . ' 
                LEFT JOIN ' . BANLIST_TABLE . " b ON (user_id = b.ban_userid) 
                WHERE (b.ban_id IS NULL 
                OR b.ban_exclude = 1) 
                AND user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $day, $month)) . "%' 
                AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';

maybe just
AND user_id NOT in (SELECT ban_userid FROM " . BANLIST_TABLE . ")
I don't have mysql here, so I can't "explain" queries but I think your one is better.


