I have a database where I have the following contact table in the image:
idservicio | idcliente | nombre contacto | telefono |
---|---|---|---|
76543 | 2 | maria perez | 123456 |
76543 | 2 | miguel o | 765433 |
98765 | 1 | sara perez | 876658 |
98765 | 1 | jose o | 987665 |
98765 | 1 | orlando | 876540 |
76543 | 3 | jack | 123456 |
76543 | 3 | ana | 654324 |
76543 | 3 | kevin | 954326 |
and I want to perform a query where the output is as follows:
idservicio | idcliente | telefono 1 | telefono 2 | telefono 3 |
---|---|---|---|---|
76543 | 2 | 123456 | 765433 | |
98765 | 1 | 876658 | 987665 | 876540 |
76543 | 3 | 123456 | 654324 | 954326 |
In sql server I did it with row_number over partition by , how can I do it in mysql, I have version 5.7.36