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? 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 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) Link to comment https://forums.phpfreaks.com/topic/151095-counting-record-values/#findComment-795863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.