how can i create a stored procedure

D

diaExcel

I have three tables in Access: "wholesale", "profi", and "min_value".
The "wholesale" table has this structure:

code (string)-primary key
type (string)-primary key
start_date(date)-primary key
end_date (date)-primary key
total_charge (double)
total_duration (double)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

the "profi" table has:

code (string)-primary key
type (string)-primary key
company_name (string)-primary key
nationality (string)-primary key
month (string)-primary key
year (string)-primary key
retail_charge (double)
retail_duration (double)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

and the "min_value" has:

company_name (string)-primary key
code (string)-primary key
type (string)-primary key
value(double)

and with those tables I have to create a stored procedure in access to
calculate sum(total_charge), sum(total_duration), sum(retail_charge),
sum(retail_duration), with the next parameters: code, company_name, type,
start_date, end_date, month, year.

Thank you.
 
J

John W. Vinson

and with those tables I have to create a stored procedure in access to
calculate sum(total_charge), sum(total_duration), sum(retail_charge),
sum(retail_duration), with the next parameters: code, company_name, type,
start_date, end_date, month, year.

A stored procedure would not be necessary; a very simple Totals query would do
this. Create a Query joining the tables, change it to a Totals query by
clicking the Greek Sigma icon, and group by the appropriate fields. Change the
Totals row to "Where" for fields to be used only as criteria, to "Sum" for the
fields you want to total, and leave the default "Group By" for fields that
define the grouping (if any).
 
D

diaExcel

I must to create a "stored procedure" in access or multi-queries for those
tables, which can calculate sum(total_charge)/sum(total_duration) by code,
type. start_date, end_date, with data from wholesale table, and to calculate
sum(retail_charge)/sum(retail_duration) by code, company_name, month, year
with data from "profi" table.
 

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