transform count(p.Sesso) as conteggio select year(p2.DATA_VISITA) as anno from PAZIENTI as p INNER JOIN (PAZIENTI_2 as p2 ON p.ID =p2.IDPaziente) where p.Codice_Medico= '$medico' group by year(p2.DATA_VISITA) order by year(p2.DATA_VISITA) pivot p.Sesso in ('M','F')"
Ragazzi con questa query io voglio visualizzare il numero di maschi e femmine in base all'anno e il totale. Ma mi da errore:
Query non valida: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'transform count(p.Sesso) as conteggio select year(p2.DATA_VISITA) as anno from P' at line 1
Dove sbaglio?