我有一个查询
$query = "INSERT INTO `user`
(`fname`,
`lname`,
`email`,
`password`,
`permission`,
`idcustomer`)
VALUES
(
'" . $firstname . "',
'" . $lastname . "',
'" . $email . "',
'" . $password . "',
'admin',
" . $idcustomer . "
);";
现在,我只需要执行此查询,以下查询的结果是 > 0:
select (number_of_users - (select count(*) from user where idcustomer=2)) availableUsers
from customer where idcustomer=2