SELECT
 ROW_NUMBER() OVER (ORDER BY lastAttempt DESC) AS no,

 CASE
 WHEN LEFT(HEX(ip), 24) = '00000000000000000000FFFF'
 THEN INET_NTOA(CONV(RIGHT(HEX(ip), 8), 16, 10))
 ELSE INET6_NTOA(ip)
 END AS ip_address,
 blockedHits,
 reason,
 FROM_UNIXTIME(lastAttempt) AS last_attempt
FROM wpbw_wfblocks7
WHERE lastAttempt > 0
ORDER BY lastAttempt desc