0

I thought i did something like this before:

$reg = mysql_query ("(SELECT count(*) from vouchers) as total_vouchers), 
                     (SELECT count(*) from vouchers WHERE asignado = 1) as vouchers_asignados,
                     (SELECT count(*) from crm) as crm_users,
                     (SELECT count(*) from datos_modificados) as dm_users") or die(mysql_error());

But it would return mysql_error near the first , :

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 'as total_vouchers), ((SELECT count(*) from vouchers WHERE asignado = 1) a' at line 1

Any idea why?

1 Answer 1

3

Try to add select as below

$reg = mysql_query ("SELECT
                     (SELECT count(*) from vouchers) as total_vouchers, 
                     (SELECT count(*) from vouchers WHERE asignado = 1) as vouchers_asignados,
                     (SELECT count(*) from crm) as crm_users,
                     (SELECT count(*) from datos_modificados) as dm_users") or die(mysql_error());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.