Create function for formatting from (X-1, X-2, X-3) to ('X-1', 'X-2', 'X-3')

Asked

Viewed 55 times

0

I have a query that returns some char type keys like this X-1, X-2, X-3. The problem is that now I need to use with where chaves in( ... ) and would have to format the values to 'X-1', 'X-2', 'X-3'. That would save me some relationships...

As this is all within the query, I cannot format with PHP, so I thought about creating a function in MYSQL for this purpose, but I don’t know which functions would use.

X-1, X-2, X-3 are keys concatenated with group_concat to play in the clause in( ... ), for this reason needed to format.

  • I think I solved with the function itself using parameters: group_concat( '"' , chaves , '"' ) : "X-1","X-2","X-3".

  • Didn’t work out as expected.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.