Home » SQL & PL/SQL » SQL & PL/SQL » how to compare the columns and return the value thorugh a query? (merged 3)
how to compare the columns and return the value thorugh a query? (merged 3) [message #437808] Wed, 06 January 2010 02:23 Go to next message
fazal_haq2001
Messages: 35
Registered: July 2006
Location: India
Member
Hi,
I ve a doubt by wrting the query
I ve athe table with 2 fields brt_from & brt_to in a table
If brt_from & brt_to values are same It ve to return brt_from
otherwise it ve to return concatenation of both ..
I tried it through decode function.but i think it will check by values only.How to compare columns.please assist..Thanks in advance ..
Regards,
Haq..
Re: how to compare the columns and return the value thorugh a query? [message #437811 is a reply to message #437808] Wed, 06 January 2010 02:25 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
It can be done with the decode function. The decode function does a comparison between two of it's parameters.

decode

Re: how to compare the columns and return the value thorugh a query? [message #437813 is a reply to message #437811] Wed, 06 January 2010 02:27 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Or you can use CASE, which makes inequality comparisons easier
Previous Topic: Reading a Package
Next Topic: help required with date and time inserts
Goto Forum:
  


Current Time: Wed Dec 07 18:24:55 CST 2016

Total time taken to generate the page: 0.14879 seconds