techker Posted January 15, 2012 Share Posted January 15, 2012 hey guys in a DB i have multiple fields 1 F_ID 2 Nom 3 Foyer 4 Matiere 5 Prof 6 Motif 7 Notes_Sortie 8 Travail 9 Code_P 10 Date_Rempli 11 Surveillant 12 Comportement 13 C_Notes 14 Status 15 Status_Date 16 Bilan 17 Latreve_status 18 Heure_S 19 User_ID 20 Periode Now i wan't to query Foyer so it shows all the Foyer.and show at the same time how many students are in this Foyer.. so my query to show all the Foyer is to add Group By Foyer.but how can i add how many students? goup By Foyer and count(Nom) cause a student is associated to a foyer.(foyer is a type of division) Quote Link to comment https://forums.phpfreaks.com/topic/255064-query-help-pls/ Share on other sites More sharing options...
techker Posted January 15, 2012 Author Share Posted January 15, 2012 ok i think i got it. SELECT `Foyer` , COUNT( `Foyer` ) FROM Formulaire_S GROUP BY `Foyer` LIMIT 0 , 30 Quote Link to comment https://forums.phpfreaks.com/topic/255064-query-help-pls/#findComment-1307863 Share on other sites More sharing options...
Muddy_Funster Posted January 15, 2012 Share Posted January 15, 2012 SELECT Foyer, COUNT(Student) as No_Of_Students FROM Formulaire_S GROUP BY Foyer ORDER BY Foyer ASC LIMIT 0, 30 Quote Link to comment https://forums.phpfreaks.com/topic/255064-query-help-pls/#findComment-1307864 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.