ViciousC Posted February 6, 2008 Share Posted February 6, 2008 The Table is called red with 7 fields marked as Red1 - Red7 ..... There are 101 entries in the table...each field id filled with number 1-50....... NOW the question.... How would i find out how many times say a number like 25 is listed in the field Red1? Quote Link to comment https://forums.phpfreaks.com/topic/89678-repetition-in-a-database-field/ Share on other sites More sharing options...
Barand Posted February 6, 2008 Share Posted February 6, 2008 This is a "how to search a badly designed table" question, not math. Quote Link to comment https://forums.phpfreaks.com/topic/89678-repetition-in-a-database-field/#findComment-459560 Share on other sites More sharing options...
fenway Posted February 6, 2008 Share Posted February 6, 2008 Agreed.... no number should ever appear "twice" in any field. Quote Link to comment https://forums.phpfreaks.com/topic/89678-repetition-in-a-database-field/#findComment-459864 Share on other sites More sharing options...
Barand Posted February 6, 2008 Share Posted February 6, 2008 This will give counts of each number in Red1 SELECT Red1, COUNT(*) as total FROM Red GROUP BY Red1 Quote Link to comment https://forums.phpfreaks.com/topic/89678-repetition-in-a-database-field/#findComment-460025 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.