0

此查询将返回错误(字段列表中的未知列 numero_propostas)。我想要的是这样的:

SELECT COUNT(*) as numero_propostas, 
       total as total, 
       (numero_propostas / total) as divisao 
FROM ConsultaArtigos2 AS ca
...

正确的方法是什么?

4

2 回答 2

1
SELECT COUNT(*) as numero_propostas, 
       total as total, 
       (COUNT(*)/ total) as divisao 
FROM ConsultaArtigos2 AS ca...
于 2013-03-13T10:37:33.597 回答
1

在 MySQL 查询语句中,您必须在引用位置使用列名

  SELECT COUNT(*) as numero_propostas, 
         total as total, 
         (COUNT(*) / total) as divisao 
   FROM ConsultaArtigos2 AS ca
于 2013-03-13T10:38:24.177 回答