SELECT u.id AS student_id, u.firstname AS student_firstname, u.lastname AS student_lastname, u.phone AS student_phone, up.country AS student_country, parent_user.id AS parent_id, parent_user.firstname AS parent_firstname, parent_user.lastname AS parent_lastname, parent_user.phone AS parent_phone, parent_profile.country AS parent_country, p.status AS relationship_status, u.created_at AS student_signup_unix FROM user u LEFT JOIN user_profile up ON u.id = up.user_id LEFT JOIN parents p ON p.student_id = u.id LEFT JOIN user parent_user ON parent_user.id = p.parent_id LEFT JOIN user_profile parent_profile ON parent_profile.user_id = p.parent_id WHERE u.type = 'student' AND u.created_at BETWEEN 1740783600 AND 1743375600 AND ( ( NOT ( u.phone LIKE '234%' OR u.phone LIKE '080%' OR u.phone LIKE '081%' OR u.phone LIKE '070%' OR u.phone LIKE '090%' OR u.phone LIKE '091%' ) OR NOT ( parent_user.phone LIKE '234%' OR parent_user.phone LIKE '080%' OR parent_user.phone LIKE '081%' OR parent_user.phone LIKE '070%' OR parent_user.phone LIKE '090%' OR parent_user.phone LIKE '091%' ) ) AND ( LOWER(up.country) NOT IN ('nigeria') OR up.country IS NULL ) AND ( LOWER(parent_profile.country) NOT IN ('nigeria') OR parent_profile.country IS NULL ) );
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter