I'm trying to select names out of a database. The names are companies with parent and if applicable child accounts like this:
parent_a
parent_b
parent_b:child_b1
parent_b:child_b2
parent_c:child_c1
What I want to select out is unique values before the colon delimiter so my query on the above rows would select:
parent_a
parent_b
parent_c
The issue is arising from the fact that some companies have only a parent (no delimiter as in parent_a above) so when I am trying to select the string before the delimiter, there isn't a delimiter and doesn't return the row at all.
I'm trying to accomplish this strictly through MySQL but if necessary I could pull out all rows and filter the results through PHP.