dennismonsewicz Posted September 12, 2008 Share Posted September 12, 2008 Is there anyway to count the number of times a particular name shows up in a sql string and manipulate that particular name? IE: if I have a string like this: dog, cat, horse, dog, fish, donkey, cow, dog, bull And then I wanted to count the number of times dog shows up... any ideas? Link to comment https://forums.phpfreaks.com/topic/123991-counting-numerous-names-in-a-sql-string/ Share on other sites More sharing options...
Caesar Posted September 12, 2008 Share Posted September 12, 2008 preg_match_all() Link to comment https://forums.phpfreaks.com/topic/123991-counting-numerous-names-in-a-sql-string/#findComment-640082 Share on other sites More sharing options...
DarkWater Posted September 12, 2008 Share Posted September 12, 2008 Why is there a CSV in a MySQL column? There should never, ever, ever, ever, never ever never be a CSV in a column. Ever. Read up on database normalization. If you had a normalized database, this would be quite a simple query. Link to comment https://forums.phpfreaks.com/topic/123991-counting-numerous-names-in-a-sql-string/#findComment-640083 Share on other sites More sharing options...
dennismonsewicz Posted September 12, 2008 Author Share Posted September 12, 2008 alright, I shall take a look at it. I haven't really gotten a good jump on all of the joining that you can do in mysql but I reckon this is a good place to start Link to comment https://forums.phpfreaks.com/topic/123991-counting-numerous-names-in-a-sql-string/#findComment-640085 Share on other sites More sharing options...
dennismonsewicz Posted September 12, 2008 Author Share Posted September 12, 2008 also why is having a CSV in a MySQL column bad? Link to comment https://forums.phpfreaks.com/topic/123991-counting-numerous-names-in-a-sql-string/#findComment-640099 Share on other sites More sharing options...
DarkWater Posted September 12, 2008 Share Posted September 12, 2008 Because you can't do anything with the data. Link to comment https://forums.phpfreaks.com/topic/123991-counting-numerous-names-in-a-sql-string/#findComment-640103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.