0

I have a relatively simple SQL query which I am using to return the first character from all rows in a table (grouped by that character) in order to create a filter where users can pick 'by surname'. I have some bad data in the table where non alpha characters have been used, i.e. full stops, commas and brackets and I would like to ignore these in the query.

SELECT UPPER(SUBSTRING(field_id_35, 1, 1)) as surname
FROM exp_channel_data
WHERE channel_id=8 AND field_id_35<>''
GROUP BY surname order by surname

How would I go about doing that? I have tried using REGEXP but without success. Any pointers greatly appreciated. :)

Nathan Pitman
  • 2,286
  • 4
  • 30
  • 46

0 Answers0