How do I add a column that calculates the product of two fields?

E

Elizabeth

Here's my current SQL code (which works BEAUTIFULLY, by the way! Thank you,
Discussion group for your assistance and allowing me to plagarize, LOL.)

*******

Select [POS_ID],[Posted
Date],[Salesrep],[EndCustomer],[ShipCustomer],[Value],[Reason],[Prod/Serv],[Op],[Region],[AM/Team],[Claim_Split_%],[Order Type],[Report Name]
From [Table - POS]
Union All
Select [POS_ID],[Posted
Date],[Salesrep],[EndCustomer],[ShipCustomer],[Value],[Reason],[Prod/Serv],[Op],[Region],[AM/Team],[Claim_Split_%],[Order Type],[Report Name]
From [Table - Manual]
Union All
Select [POS_ID],[Posted
Date],[Salesrep],[EndCustomer],[ShipCustomer],[Value],[Reason],[Prod/Serv],[Op],[Region],[AM/Team],[Claim_Split_%],[Order Type],[Report Name]
From [Table - Unallocated]
UNION ALL
Select [POS_ID],[Posted
Date],[Salesrep],[EndCustomer],[ShipCustomer],[Value],[Reason],[Prod/Serv],[Op],[Region],[AM/Team],[Claim_Split_%],[Order Type],[Report Name]
From [Table - Unclaimed Sherrel]
UNION ALL Select [POS_ID],[Posted
Date],[Salesrep],[EndCustomer],[ShipCustomer],[Value],[Reason],[Prod/Serv],[Op],[Region],[AM/Team],[Claim_Split_%],[Order Type],[Report Name]
From [Table - Unclaimed POS Carl]

***************

How do I add a column that gives me the product of the "[Value]" times the
"[Claim_split_%]" for each record? Since I created this using SQL, it won't
let me see the query "skeleton" as a table, but I know NOTHING about writing
SQL code...I just copy and paste...so I can't figure out how to edit this
query.

Thanks,
Elizabeth
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In each SELECT clause (that's the area between the word SELECT and
FROM), after [Report Name] put in

[Report Name], [Value] * [Claim_split_%] As Discount

You can change "Discount" to any name you want for the resultant column
(field).

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSp1+EoechKqOuFEgEQJ67wCgga9Igt+IUJZqcZSo/veKZ+/SUT0AnRbq
2gK9u2RBdG2yxoISmOqps+NX
=x5QC
-----END PGP SIGNATURE-----
 
K

KARL DEWEY

Edit the SQL like this ---
Select [POS_ID],[Posted
Date],[Salesrep],[EndCustomer],[ShipCustomer],[Value],[Reason],[Prod/Serv],[Op],[Region],[AM/Team],[Claim_Split_%],[Order
Type],[Report Name], [Value]*[Claim_Split_%] AS MyAnswer
From [Table - POS]
Union All .....

Substitute whatever name you want for the ouput field for MyAnswer,
remembering to enclose in quotes if using a space or other than a letter
character in the name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top