c_pattle Posted January 22, 2011 Share Posted January 22, 2011 I have a table with a field called "tags" and below is an example of how this field might look like. pensions, employee benefits, group benefits, defined contribution, auto-enrollment I want to perform a query to get this field for all of the rows in my table. However is there a way to stop mysql from returning duplicates. For example if another field read, pensions, employee benefits, group benefits, defined contribution, auto-enrollment, tax Then it would only return "tax" from this field as it's already return pensions, employee benefits etc. Thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/225322-phpmysql-select-help/ Share on other sites More sharing options...
BlueSkyIS Posted January 22, 2011 Share Posted January 22, 2011 it sounds like you should have a separate table for "tags", with a single string value, many-to-one relation back to the parent table. what you are suggesting could be done but it would be quite complex, thus pointing out a inefficiency in the database design. Quote Link to comment https://forums.phpfreaks.com/topic/225322-phpmysql-select-help/#findComment-1163618 Share on other sites More sharing options...
ManiacDan Posted January 22, 2011 Share Posted January 22, 2011 Agreed with BlueSky, look up "third normal form" on wikipedia and read about how to properly design a normalized database. -Dan Quote Link to comment https://forums.phpfreaks.com/topic/225322-phpmysql-select-help/#findComment-1163697 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.