Writing a query for automatic data insertion based on fields in another table/query

adkale

New member
Local time
Today, 00:48
Joined
Jun 25, 2012
Messages
2
I am looking to pull out the year and month data from DATE data type. This is easy I know using year() and month(). But I want this data to add rows in another table based on the value of the month and the year and Another numeric field?
I have 'DateFrom', 'DateTo' date fields and an 'Amount' field in one table.
I have month another table wherethe fields are:

ID - autonumber
year
jan
feb
.
.
.
dec.

I want the values in each field above i.e. jan, feb .... dec. to be
(Amount/No. of months in the period)

Based on this I want to fill out my YearlySales table as follows

Date from: 1st June 2012 Date to: 31st May 2013
year jan feb mar apr may jun jul aug sep oct nov dec

2012 N N N N N Y Y Y Y Y Y Y

2013 Y Y Y Y Y N N N N N N N




Could someone please assist me with this.
It'll be of great help.
Thank You.
 
A few other good Normalization topics:

http://support.microsoft.com/kb/283878

http://r937.com/relational.html

Normalize.png
 

Users who are viewing this thread

Back
Top Bottom