Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

SQL select statement using same column twice

$
0
0

I have a simple select statement from one table that lists the same numeric column (TRANAMT) twice. If the number is positive ('>'0) I want it to show in the first reference of TRANAMT. If the number is negative ('<'0) I want it to should in the next reference of TRANAMT. Ideally if the number is positive it will show on the first reference and the second will display 0 or null. If negative the first reference shows 0 or null and the second reference shows the negative number.

select FNAME, LNAME, TRANAMT, TRANAMT from CMLEDG

Please let me know if this is possible. Thanks Ken


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>