Fixed sql for notifs