select t1.id,t1.number, case when t2.id is not null then 'blacklist' when t3.id is not null then 'whitelist' else '-' end as list
from journal t1
left join blacklist t2 on t1.number = t2.number
left join whitelist t3 on t1.number = t3.number
{
$(".result").addClass( "hidden" );
$("#myModalLabel").html('Сообщение отправлено!');
$("#cButton").removeClass( "hidden" );
$(".modal-header").addClass("text-center");
$('#name').val('');
$('#email').val('');
$('#message').val('');
$('#phone').val('');
}
$(".result").removeClass( "hidden" ); .....