Bring the value of one column according to the condition of another

Asked

Viewed 50 times

0

I am developing a simple script but I came across a situation that I am not able to solve it, I tried through CASE but without success.

With a simple select I need to bring the columns Name, RG, CPF, and the customer’s CELL phone, that is the problem, because the structure of the table lies like this:

inserir a descrição da imagem aqui

So, I should bring the CONTACT 2 that is the contact corresponding to CONTACT FORM of cellular, in the system these fields are editable, so it varies from registration to registration, has record that the contact 1 is cellular, in other 3 and so on.

So to illustrate, my select would look like this:

Name, RG, CPF, CELLULAR (And in this cell column would bring the column corresponding to cellular FORMADECONTATE, which in this example is CONTATO2)

Thank you for your attention and cooperation.

  • 1

    Which database?

  • The problem was in my personal CASE, it was solved. Thank you!

  • 1

    Related -> https://answall.com/questions/14343/likedifferentiation of telephone types

No answers

Browser other questions tagged

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