当获取多行作为结果时,Mysql查询返回NULL值

Below is my query

 SELECT `months`,SUM(`price`) AS price 
 FROM `billing` 
 WHERE months='January' AND months='Feb'

I am trying to get result but this query is returning value NULL

finally I got answer of my question ans is: SELECT months,sum(price) as price FROM billing GROUP BY months

I think that you might want to use OR

SELECT `months`,SUM(`price`) AS price 
 FROM `billing` 
 WHERE months='January' OR months='Feb'

Assuming that you want to show the result for the months of January and February, your query should look like:

SELECT months, SUM(price) AS price 
FROM billing 
WHERE months='January' OR months='Feb'

Also, you can use:

SELECT months, SUM(price) AS price 
FROM billing 
WHERE months IN ('January', 'Feb')

This second option will do the same since it will retrieve all the entries which "months" field matches with any value in the tuple.