MySQL doesn't support Common Table Expressions (CTE) so either your
mysql tag is incorrect or you've pulled this syntax from nowhere.
To make this work with MySQL, you'll need to rewrite it as derived tables. Note, these sql fiddles use the question that was a duplicate of this as it was at least more interesting to answer.https://stackoverflow.com/questions/1382573/how-do-you-use-the-with-clause-in-mysql
This is the SQL Server version but I guarantee whatever logic you're attempting could be simplified if you explained what you were attempting to do versus "code doesn't work"
This specific question suffers from two issues: The first and already addressed is that CTEs
WITH don't exist in mysql.
The second is simply syntax. You have
SELECTMAX instead of
WITH max_budget(value) AS (SELECT MAX(budget) FROM department)
FROM department, max_budget
WHERE department.budget = max_budget.value;
The above is valid syntax for SQL Server and all DBMS that have implemented CTEs. The MySQL equivalent follows
SELECT MAX(budget) FROM department
This uses a correlated subquery which has the distinct advantage of working in SQL Server, MySQL, PostGres, etc.
You could also write it as a derived table:
SELECT MAX(budget) AS value FROM department
department.budget = max_budget.value ;