Problem Description –
Write an SQL query to find the
account_id of the accounts that should be banned from Leetflex. An account should be banned if it was logged in at some moment from two different IP addresses.
Return the result table in any order.
The query result format is in the following example.
Problem Link – Leetflex
Difficulty Level – Medium
SELECT DISTINCT t1.account_id FROM LogInfo as t1, LogInfo as t2 WHERE t1.login BETWEEN t2.login AND t2.logout AND t1.account_id = t2.account_id AND t1.ip_address != t2.ip_address