SELECT
a.item_id,
b.reason
FROM
q_access_restriction as a
LEFT JOIN q_access_restriction_reason_descriptions as b ON a.item_id = b.item_id
AND a.type = b.type
AND lang_code = 'en'
WHERE
(
ip_from <= 316343470
AND ip_to >= 316343470
)
AND a.type IN ('ips', 'ipr', 'ipb')
AND status = 'A'