i had one table farm. 4 column; id, refer_no, state and area. i am trying to find overall farmer and area in states. before i run my query, i total up the value in excel first to make sure the data is same as the output. however the value is not same. i did try query it separately to find which part is wrong, but the result is still same. below is my query;
if i lack any information, please guide me. i really appreciated it.
SELECT SUM(totalfarmer) AS overallfarmer, SUM(totalarea) AS overallarea from ( select state,COUNT(DISTINCT(refer_no)) AS totalfarmer, SUM(area) AS totalarea FROM farm GROUP BY state ) as overallx