PC Review


Reply
Thread Tools Rate Thread

Database query and calculation

 
 
Cesar
Guest
Posts: n/a
 
      27th Oct 2008
Hi,

I'm using a query to pull data from a SQL database, I have some criteria on
it as Date. I need to create a new field multiplying the sales value times
the % of commission but the problem is that the % of Commision is not a value
in a table or field, is a changable value that I need to be asked every time
I run the query, kind in the same way I am asked for the Date (criteria). Is
there a way to do it here in the query or do I have to do it with code in
excel?
please help
--
Cesar
 
Reply With Quote
 
 
 
 
dmoney
Guest
Posts: n/a
 
      27th Oct 2008
post the querry

"Cesar" wrote:

> Hi,
>
> I'm using a query to pull data from a SQL database, I have some criteria on
> it as Date. I need to create a new field multiplying the sales value times
> the % of commission but the problem is that the % of Commision is not a value
> in a table or field, is a changable value that I need to be asked every time
> I run the query, kind in the same way I am asked for the Date (criteria). Is
> there a way to do it here in the query or do I have to do it with code in
> excel?
> please help
> --
> Cesar

 
Reply With Quote
 
Cesar
Guest
Posts: n/a
 
      28th Oct 2008
Thanks for the answer,

My query is quite different from the one I asked help, I did it in that way
to simplify the question but the problem still the same.

here is the SQL statement:

SELECT VW_PARENT_ROLL_LIST.S_PROLL_ID AS 'ROLL ID',
VW_PARENT_ROLL_LIST.D_PROLL_PTIME AS 'PROD TIME',
VW_PARENT_ROLL_LIST.S_SPEC_NAME AS 'GRADE',
VW_PARENT_ROLL_LIST.NT_TP_BP_AKD_REEL_TOTAL AS 'AKD',
VW_PARENT_ROLL_LIST.NT_TP_BP_POLYMER_REEL_TOTAL AS 'POLYMER',
VW_PARENT_ROLL_LIST.NT_TP_BP_HERCOBOND_REEL_TOTAL AS 'HERCOBOND',
VW_PARENT_ROLL_LIST.NT_Starch_Bar_Reel_Total AS 'STARCH BAR',
VW_PARENT_ROLL_LIST.NT_TP_DYE_REEL_TOTAL AS 'DYE',
VW_PARENT_ROLL_LIST.UOMX_203_ORIG_WT AS 'WT TONS'
FROM PROD_DMPC.dbo.VW_PARENT_ROLL_LIST VW_PARENT_ROLL_LIST
WHERE (VW_PARENT_ROLL_LIST.D_PROLL_PTIME>=? And
VW_PARENT_ROLL_LIST.D_PROLL_PTIME<=?) AND (VW_PARENT_ROLL_LIST.S_SPEC_NAME=?)
ORDER BY VW_PARENT_ROLL_LIST.D_PROLL_PTIME

What I want to do is crear a new field that calculates the cost of using
POLYMER by multipling VW_PARENT_ROLL_LIST.NT_TP_BP_POLYMER_REEL_TOTAL times a
value that I want to be asked every time I run the query, this is because the
cost of Polymer changes with time and it is not a value in a field or table.

Basically the same apply for the rest of the columns, in the same way that I
want to creat new field for POLYMER COST, I want to create new fields for
AKD, HERCOBOND, STARCH and DYE

Thanks, hope that's what you were asking
--
Cesar


"Cesar" wrote:

> Hi,
>
> I'm using a query to pull data from a SQL database, I have some criteria on
> it as Date. I need to create a new field multiplying the sales value times
> the % of commission but the problem is that the % of Commision is not a value
> in a table or field, is a changable value that I need to be asked every time
> I run the query, kind in the same way I am asked for the Date (criteria). Is
> there a way to do it here in the query or do I have to do it with code in
> excel?
> please help
> --
> Cesar

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Criteria on query w/ calculation acts like perameter query HLCruz via AccessMonster.com Microsoft Access Queries 1 8th May 2007 10:38 PM
Query secondary calculation reference to query's own calculated field? G Lykos Microsoft Access Queries 1 14th Jun 2006 04:46 AM
HELP WITH CALCULATION IN DATABASE =?Utf-8?B?bXJ3b2xsZXk=?= Microsoft Access VBA Modules 2 20th Apr 2006 09:31 PM
Percentage Calculation in Database =?Utf-8?B?QW1pdA==?= Microsoft Access 3 13th Sep 2005 07:16 PM
No result query feeding a query that does a calculation =?Utf-8?B?U3RldmVS?= Microsoft Access Queries 2 18th Aug 2005 01:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:44 AM.