$max = $DB_site->query_first('SELECT MAX(column2) AS maxval FROM table'); $result = $DB_site->query('SELECT column1 FROM table WHERE column2 > '.($max['maxval']-5));