Go4Expert

Go4Expert (http://www.go4expert.com/)
-   SQL Server (http://www.go4expert.com/forums/sql-server-forum/)
-   -   How to generate an additional field (http://www.go4expert.com/forums/generate-additional-field-t707/)

fdtoo 12Apr2006 06:23

How to generate an additional field
 
I have the following fields in table A:

Code:

GL_ID|GL_Name_VC|    Amount    |Period_TI|Year_SI|
===================================================
  1000|  Sales_HW|  -20,000.00  |  01    |  2005
===================================================
  1000|  Sales_SW|  -10,000.00  |  01    |  2005
===================================================
  1001|  Cost_HW |    5,000.00  |  01    |  2005
===================================================
  1001|  Cost_SW |    5,000.00  |  01    |  2005

the fields above have the following datatype:

Code:

Fields        | Datatype               
 ===================================
 GL_ID        | Integer           
 GL_Name_VC    | Variable Character
 Amount        | Integer
 Period_TI    | TinyInteger
 Year_SI      | SmallInteger

The above database is running on Microsoft SQL Server 2000 and i would like to query
for a report that looks something as below:

Code:

Sales Category  |  Sales  |  Cost  |  Profit
=================================================
    HW        |-20,000.00 |5,000.00| -15,000.00
    SW        |-10,000.00 |5,000.00|  -5,000.00
=================================================
    Total      |-30,000.00 |10,000.00|-20,000.00

The above report have 4 columns, with last column being a calculated field (Sales-Cost)

Guys, hope someone out there can help me with the sql command for the above report?

coderzone 12Apr2006 15:19

Re: How to generate an additional field
 
Reply to How to multiply two value from two fields will solve your problem.


All times are GMT +5.5. The time now is 01:09.