September 9th, 2012, 08:57 AM
[RESOLVED] SQL Query Problem
I have an SQL Query which lists records from a Table which contains Invoices and Credits.
The problem is that the Values are Positive for both Invoices and Credits - Just that the Document Type Shows which is which.
My problem is that I want to sum the Total Value by ADDING Invoice Vales and SUBTRACTING Credit values.
Is it possible to somehow change the Amount to be Negative in an SQL Statement (Based on a Column value containing the word "Credit")
This is my current query
DDocType contains "Invoice" or "Credit"
Select [Territory] , [OBatch], [DDocType], [DDocNo], [DDocDate], [Account], [Company], [Value] from [OrderArchiveIndex] ORDER BY [Territory] ASC , [Account] ASC
Value contains a Positive Value always - would like this to become Negative if DDOCType = "Credit"
Thanks for any ideas
PS - Found the Code Tags - they dont seem to be part of "QUICK REPLY"
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.