Subhajit Subhajit - 7 months ago 43
SQL Question

select distinct rows without special character in the first occurrence in mysql

I have a column in mysql table with rows like

CT Scan
CT Scan
CCT Test
CCT Test
CCT Test


As you can see the values are same but the occurrence in some has a space as first character.

I would like to select the distinct records from that table, which will eventually be like

CT Scan
CCT Test


Currently running the distinct query gives me all the records

Answer
select distinct trim(col) from your_table