| Author |
SUM using two attributes
|
rahull agarwal
Ranch Hand
Joined: Dec 20, 2010
Posts: 31
|
|
Hi,
My table has two columns amount and amountEstimated.
I would like to get a sum of the money using following logic.
If (amount == null) use amountEstimated
Else use amount.
How do I write a SQL for this?
Thanks so much for your help
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
That depends on what database you are using. Here is a page which gives examples for a couple of the more common databases.
|
 |
 |
|
|
subject: SUM using two attributes
|
|
|