Split string no MySQL

O MySQL não tem uma função para quebrar strings separadas por um determinado caractere (vírgula, por exemplo). A maioria das soluções que encontrei na web são baseadas em procedures. Não satisfeito com essa opção, fiz alguns estudos e cheguei à seguinte query: SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(‘1,2,3,4,5’, ‘,’, `i`), ‘,’, -1) AS `val` FROM ( SELECT @n …

Retrieving an hierarchical tree recursively with PL/PgSQL

From PostgreSQL 8.4 you can write WITH queries using the optional RECURSIVE modifier to make a query refer to its own output. Ok, but if I’m using a previous version of PostgreSQL? What can I do? I had this same question and, after some research, I found a solution based on functions. Below I’ll explain …