SQL : select one column if two columns are equal, else select both -


i have following sql select problem:

i have 2 columns positive threshold , negative threshold (among several other columns name, ids.... ).

  • if (absolute) value same (multiply -1) want select positive threshold column [threshold].

  • if values different, want select 2 columns [positivethreshold] , [negativethreshold].

thank in advance.

select null [threshold], positivethreshold, negativethreshold  table  negativethreshold null  or (positivethreshold + negativethreshold) <> 0  union select positivethreshold, null, null table  (positivethreshold + negativethreshold) = 0 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -