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: 4963
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: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
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: Sat Feb 15 12:12:16 CST 2025