Need to count distinct number of occurances in a non-normalizedfield

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Manners
    New Member
    • Nov 2011
    • 1

    Need to count distinct number of occurances in a non-normalizedfield

    I have a field that contains multiple values seperated by |*|

    So the field looks like this name1|*|name2|* |name3

    I need to count how many unique,or distinct name are in that field and return a total number. So, the above example would return 3 total names.

    So by way of continuing explanation:
    If the first row contained: name1|*|name2
    The second row contained: name1|*|name2
    The resulting querry would return a total of 2 distinct names.

    Hope this makes sense and I HOPE someone can help me.

    I know this isn't normalized but it is the database I was dealt.

    Tom
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    first of all I dont think mysql has any function that would let you break a string into small pieces.

    how about using other programming language like C or php.

    if it is php, then its very easy but if it is C then possible but not easy..

    Comment

    Working...