This week I had a SELECT a little more complex to execute, that I needed to concatenate a string with a field value of the own table that I was selecting. I didn’t wanted to split my sentence in two on PHP, I was convinced that should have a way to do that without depending on PHP to pass a field value to a second query.
My first attempt was doing:
1 |
SELECT a.campo, b.campo, c.campo FROM tabela1 a, tabela2 b, tabela3 c WHERE a.campo2='string_'+b.campo2 AND c.campo3 = b.campo3 |