I am developing a simple script but I came across a situation that I am not able to solve, I tried through CASE but without success.
With a simple select I need to bring the columns Name, RG, CPF, and the CELLULAR telephone of the client , then there is the problem, since the table structure looks like this:
So, I must bring the CONTACT 2 that is the contact corresponding to the FORM OF CONTACT of cellular, in the system these fields are editable, so this varies from register to register, has record that the contact 1 is the cell phone, in others 3, and so on.
So to illustrate, my select would look like this:
Name, RG, CPF, CELL (And in this cell column would bring the column corresponding to cellular FORMADECONTATO, which in this example is CONTACT2)
Thank you for your attention and cooperation.