I have a table name farmer data and it has attributes like farmer name, father name, pesticides used, town etc (these attributes would be required for query). also the data type of columns is var char. I have to write a query to calculate the average no of farmers in each town. How can I write this query? I have tried this query but its not giving me correct answer.
select Farmer_Name, Count(distinct town)
from farmer_data
group by town
i have also tried another query, its giving output in correct format but the answer of farmers are very huge values. i want number of distinct farmers in every town, this query is counting all the farmers
select town, count (*)
from farmer_data
group by town