Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Average no of farmers in each Mouza/Town.

$
0
0

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



Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>