Versuch's mal damit:
SELECT IF( ( SELECT COUNT(*) FROM `mail_virtual` WHERE `email` = 'ronny@i-t-sys.de' ) > 0, ( SELECT `policy_greylist` FROM `mail_users` RIGHT JOIN `mail_virtual` ON `mail_users`.`id` = `mail_virtual`.`popaccountid` WHERE `mail_virtual`.`email` = 'ronny@i-t-sys.de' ) , ( SELECT `policy_greylist` FROM `mail_users` RIGHT JOIN `mail_virtual` ON `mail_users`.`id` = `mail_virtual`.`popaccountid` WHERE `mail_virtual`.`email` LIKE (CONCAT('%',(SUBSTRING_INDEX('ronny@i-t-sys.de', '@', -1)))) AND `mail_virtual`.`iscatchall` = 1 ) )
Getestet mit zu wenigen Datensätzen...
Gruß René Thiel (Rennkuckuck) mailto:reti@rennkuckuck.de