0

私は前にこのようなことをしたと思った:

$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());

しかし、それは最初の近くで mysql_error を返します,:

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

理由はありますか?

4

1 に答える 1

3

select以下のように追加してみてください

$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());
于 2013-07-24T11:34:54.653 に答える