在Plotalot中使用BETWEEN子句

时间:2015-02-19 15:14:52

标签: mysql joomla2.5 between

尝试使用Plotalot图创建联赛表并显示。我正在使用BETWEEN子句,但我似乎没有得到我期望的结果,这是......没有结果!非常感谢对此的支持。

代码是

SELECT FieldName, COUNT(FieldValue) AS "Total" 
FROM jos_rsform_submission_values 
WHERE FieldName LIKE'Goals' AND "Total" BETWEEN 1 AND 20 ORDER BY Total DESC

1 个答案:

答案 0 :(得分:0)

我希望您已经知道应该使用WHERE语法的结果。

尝试不使用""

SELECT FieldName, COUNT(FieldValue) `Total`
FROM jos_rsform_submission_values 
WHERE FieldName LIKE 'Goals' AND Total BETWEEN 1 AND 20 ORDER BY Total DESC

也可以使用子查询

完成
SELECT * FROM
(    
SELECT FieldName, COUNT(FieldValue)  `Total`
FROM jos_rsform_submission_values 
WHERE FieldName LIKE 'Goals' 
) Sub WHERE Sub.Total BETWEEN 1 AND 20 
ORDER BY Sub.Total DESC

尝试此查询以确保您的匹配项总数介于1到20之间

    SELECT FieldName, COUNT(FieldValue)  `Total`
    FROM jos_rsform_submission_values 
    GROUP BY FieldName