select users.uid from users where users.channel='SIP/dito-08a02488'; +--------+ | uid | +--------+ | 000003 | | 000005 | +--------+ 2 rows in set (0.00 sec) (select users.uid from users where users.channel='SIP/dito-08a02488') union (select guests.uid from guests where guests.channel='SIP/dito-08a02488'); +--------+ | uid | +--------+ | 3 | | 5 | | 1 | +--------+ 3 rows in set (0.00 sec)