Home » SQL & PL/SQL » SQL & PL/SQL » Selecting columns depending upon comparison of two other columns (Oracle 10g on UNIX)
Selecting columns depending upon comparison of two other columns [message #355333] Thu, 23 October 2008 14:34 Go to next message
soham.desai@gmail.com
Messages: 21
Registered: August 2008
Junior Member
A table abc contains four columns a, b, c and d. I want to select a if value of c is less than d else select b.

Any help?
Re: Selecting columns depending upon comparison of two other columns [message #355336 is a reply to message #355333] Thu, 23 October 2008 14:37 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
Show us what you tried. It's a simple CASE statement.
Re: Selecting columns depending upon comparison of two other columns [message #355344 is a reply to message #355333] Thu, 23 October 2008 15:34 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use DECODE or CASE.
A good link SQL Reference.

Regards
Michel
Previous Topic: how to get the date range (merged)
Next Topic: cross join (merged)
Goto Forum:
  


Current Time: Sun Dec 04 04:55:09 CST 2016

Total time taken to generate the page: 0.09932 seconds