How to return multiple fields as a single array or string?

Asked

Viewed 57 times

-1

I have a table in the database with several phones, the name of the fields is numbered as follows: telefone1, telefone2, telefone3 your return is like this:

Array
(
    [telefone1] => 190
    [telefone2] => 197
    [telefone3] => 140
)

What I’d like to do is in select, instead of returning multiple phones, return an array with all, something like that:

Array
(
    [telefone] => Array
        (
            [0] => 190
            [1] => 197
            [2] => 140
        )

)

Or even join the fields with some character, for example, comma:

190,197,140
  • Do you want to return only using sql in sgbd or in some IDE? could you put the programming language you are using? I was a little in doubt!

  • The language is php

1 answer

2

Browser other questions tagged

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