My Table:
| code_client| tel_client | name_client | |:-----------|-------------|-------------:| | 1 | 22415671 | Roffus | | 1 | 22114511 | Roffus | | 1 | 52421671 | Roffus | | 1 | 99415671 | Roffus | | 4 | 91512371 | Mylon | | 4 | 85673221 | Mylon | | 99 | 56732671 | Alfly | | 99 | 92347671 | Alfly | | 77 | 45445671 | Nerthit | | 65 | 32354111 | Brumos |
What i want:
| code_client|tel_client_1|tel_client_2|tel_client_3|tel_client_4| |:-----------|------------|------------|------------|-----------:| | 1 | 22415671 | 22114511 | 52421671 | 99415671 | | 4 | 91512371 | 85673221 | | | | 99 | 56732671 | 92347671 | | | | 77 | 45445671 | | | | | 65 | 32354111 | | | |
In second table i need a code_client column and a max value of phone column by client with highest number of telephone.
How make this with dynamic sql?