SQL Alphabetical ordering with html code

1

I have a table that contains the titulo field. I have a query and I want to sort alphabetically by it, however, some fields are with HTML codes, I'll give examples:

  

Goat slaughtering and meat processing

     

Slaughter and Commercialize% of Animals

In the second example, for the user the correct name çã appears, but the bank is in the form shown above.

Is it possible to sort alphabetically by considering text without html codes as "readable" text?

    
asked by anonymous 18.07.2018 / 16:43

1 answer

1

You can work around this by creating another column in your database where you store accented titles.

So when you sort, you can use this new column ( titulo_com_acentos ). When returning information to the screen, you can use the current column.

 id | titulo                                           | titulo_com_acentos
 1  | Abate e Comercialização de Animais | Abate e Comercialização de Animais

This type of solution is very common when we need to extract certain information from a column in the table, but for some reason it is impracticable to extract this information at runtime. Then this extraction of information is done in an earlier step and saved in the database, synchronized with the original information.

    
24.07.2018 / 18:19