ultramagnus Posted March 25, 2009 Share Posted March 25, 2009 I have setup a table that will contain data for baseball games. I have defined the GScheduleResult field as a CHAR (1). The values of the that field will be a 'W' or 'L'. Is there a way using PHP, that I can count all the 'W''s and all the 'L's so I can then display those counts to show the overall record for a team? Quote Link to comment https://forums.phpfreaks.com/topic/151095-counting-record-values/ Share on other sites More sharing options...
Mark Baker Posted March 25, 2009 Share Posted March 25, 2009 You don't even need PHP, you can do it with a SQL query select team, GScheduleResult, COUNT(*) as Count from tableName group by team, GScheduleResult Quote Link to comment https://forums.phpfreaks.com/topic/151095-counting-record-values/#findComment-793769 Share on other sites More sharing options...
ToonMariner Posted March 28, 2009 Share Posted March 28, 2009 also performance wise use enum rather than char(1) Quote Link to comment https://forums.phpfreaks.com/topic/151095-counting-record-values/#findComment-795863 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.