i have some problems with mysql database query and its as below :
Tables :
i) departments
id
department
description
ii) farmers
id
name
sex
address
age
category
remarks
iii) scientists
id
departmentid
name
remarks
iv) scientistvisits
id
scientistid
farmerid
datevisited
purpose
remarks
Here, i want the query of number of scientist visits in a detailed way, i.e., number of visits, department wise, male farmers, female farmers, farmer category wise, total number of males, total number of females, grand total.
Please advise me for the best code for this query.
Thanking you in advance
Bobby