Working SQL query.