cant't run the follorwing Query Clause query shows an error message in goormide

Running a query that has similar syntax:

WITH table1 
AS 
(SELECT 
    COUNT(*)
FROM photos
),
table2 AS (
SELECT 
    COUNT(*)
FROM 
users
)

SELECT table1 / table2;

I'm getting the following error, but not sure why? Really new to SQL. Thanks !

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'table1 AS


You can't use the CTE syntax because you are using MySQL Server 5.7. CTE is a new feature introduced in MySQL 8.0.

But you don't need it for the query you show. You can do it this way:

SELECT table1.count / table2.count
FROM (SELECT COUNT(*) AS count FROM photos) AS table1
CROSS JOIN (SELECT COUNT(*) AS count FROM users) AS table2;