I have two tables
blacklisted_ips. The first one for logging access logs and the second one is for blacklisted ips, and both tables have a column named ip_address.
I need to select all columns from the first table and another field 'blacklisted' that tells if the ip in that access log is blacklisted or not.
I used a left join and COUNT() function to count occurences for each ip address but this will return a number, while i just need a boolean.
Here is my SQL code:
SELECT usl.*, COUNT(blip.id) as blacklisted FROM user_session_logs as usl LEFT JOIN blacklisted_ips as blip ON blip.ip_address = usl.ip_address GROUP BY usl.id