doubts when performing select

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Thu, 19 Jan 2006 11:38 am

I have the following doubts: I have a view that contains the fields value and tpPagto value tpPagto 100 pa 120 pa 300 pa 200 cm 10 cm through this view will update a table. Need to do a select that check when tpPagto is he plays the pa value in a column called Payment of my table if tpPagto is the value to be thrown into a column named Commission of my table.

Can someone help me????

Thankfully, Kamal
izaura
Location: santos-sp

Poston Thu, 19 Jan 2006 3:09 pm

Hello ... you can use a DECODE to separate the values in columns, see example below
Code: Select all
SELECT DECODE(TP_PAGTO,'PA',0,VALOR) VL_COMISSAO,
       DECODE(TP_PAGTO,'PA',VALOR,0) VL_PAGAMENTO
FROM VIEW       
TBou
Location: Campo Grande - MS

Thiago Bourscheidt
thiago.info@apoiorural.com.br
Analista de Sistemas


  • See also
    Replies
    Views
    Last Post


    Return to SQL

    Who is online

    Users browsing this forum: No registered users and 2 guests