473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Make Table Query Question

Hello,

I'm having some difficulties creating a make table query. The source
table which I'm basing the make table query has the fields:

CIF
BusLine1-2001
BusLine1-2002
BusLine1-2003
BusLine1-2004
BusLine2-2001
BusLine2-2002
etc..etc.

What I am doing is grouping by CIF summing across all other fields and
creating a table. This works fine for the time being but on a month
to month basis the field names will change, some business lines may
have 2004 revenue in say Oct which didn't in Sept. I'm trying to
create this db so that very little changes to the queries will be
needed on a monthly basis. Is there a way to write a make table query
that groups by a known field (CIF) and sums across all other fields?
Someone sent me a function which takes in a recordset as a parameter
and spits out an array of the field names in that recordset, could I
use this somehow in my make table query or is there an easier way to
go about this?

Any help on this matter would be greatly appreciated.

Thanks in advance,

Sincerly,

Hanif Merali
Nov 13 '05 #1
3 2724
Question:

Why would the field names change from month to month?
"Hanif Merali" <ru****@hotmail.com> wrote in message
news:44**************************@posting.google.c om...
Hello,

I'm having some difficulties creating a make table query. The source
table which I'm basing the make table query has the fields:

CIF
BusLine1-2001
BusLine1-2002
BusLine1-2003
BusLine1-2004
BusLine2-2001
BusLine2-2002
etc..etc.

What I am doing is grouping by CIF summing across all other fields and
creating a table. This works fine for the time being but on a month
to month basis the field names will change, some business lines may
have 2004 revenue in say Oct which didn't in Sept. I'm trying to
create this db so that very little changes to the queries will be
needed on a monthly basis. Is there a way to write a make table query
that groups by a known field (CIF) and sums across all other fields?
Someone sent me a function which takes in a recordset as a parameter
and spits out an array of the field names in that recordset, could I
use this somehow in my make table query or is there an easier way to
go about this?

Any help on this matter would be greatly appreciated.

Thanks in advance,

Sincerly,

Hanif Merali

Nov 13 '05 #2


The reason the files change is because someone sends me pivots of the
source files, the source files look like this:

CIF, Business, Year, Amount, RR, etc..etc..

the end result is to be able to create a report, there are 29 seperate
businesses, and thousands of CIF's (clients). The end result has to be
a table that has,

CIF, Business-PY, Business-CY, Business-YTD, .....

there will be PY, CY, YTD fields for all businesses

originally i had written queries to query each of the 3 source files
group by CIF, Year, sum across the AMOUNT and RR fields and update the
end result table, the way I went about this was to make temp tables for
each of the source files and update the end table from those temp
tables. This required too many queries..Is there a better way for me to
do this? The problem I am having is that the PY=2002, CY=2003, YTD=2004,
but when 2005 hits that all changes to 2003, 2004, 2005 respectively. I
also need revenues from 2001 to create a reconciliation report. The way
I went about it was to create crosstabs for each year and source file,
so source1 would have 2001, 2002, 2003, 2004 crosstabs with business
along on one axis and CIF on the other then use those crosstab temp
tables to update the report and have a macro that deletes them
afterwards. Is there a way to update the final result table with fewer
more complex queries? Any help is greatly appreciated.

Hanif

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3
Why not keep all the values (Present Year, Current Year and Year To Date,
the same and add an extra field to capture the year. This way you dont have
to change the field names.

You know something is wrong with a database design when you have to keep
changing its structure to accomodate the data.

HTH
Paul

"Hanif Merali" <ru****@hotmail.com> wrote in message
news:41**********************@news.newsgroups.ws.. .


The reason the files change is because someone sends me pivots of the
source files, the source files look like this:

CIF, Business, Year, Amount, RR, etc..etc..

the end result is to be able to create a report, there are 29 seperate
businesses, and thousands of CIF's (clients). The end result has to be
a table that has,

CIF, Business-PY, Business-CY, Business-YTD, .....

there will be PY, CY, YTD fields for all businesses

originally i had written queries to query each of the 3 source files
group by CIF, Year, sum across the AMOUNT and RR fields and update the
end result table, the way I went about this was to make temp tables for
each of the source files and update the end table from those temp
tables. This required too many queries..Is there a better way for me to
do this? The problem I am having is that the PY=2002, CY=2003, YTD=2004,
but when 2005 hits that all changes to 2003, 2004, 2005 respectively. I
also need revenues from 2001 to create a reconciliation report. The way
I went about it was to create crosstabs for each year and source file,
so source1 would have 2001, 2002, 2003, 2004 crosstabs with business
along on one axis and CIF on the other then use those crosstab temp
tables to update the report and have a macro that deletes them
afterwards. Is there a way to update the final result table with fewer
more complex queries? Any help is greatly appreciated.

Hanif

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: yvan | last post by:
Approximately once a month, a client of ours sends us a bunch of comma-delimited text files which I have to clean up and then import into their MS SQL database. All last week, I was using a Cold...
3
by: Rich N | last post by:
I want to move several records from one table to a new table. My database is set up so that there's the "regular" database, and the ".be" database. In which do I use the Make Table Query?
6
by: Eddie Smit | last post by:
field- field- surname town ---- ---- john NY john Vegas john Boston eddie Boston eddie New Orleans eddie NY
1
by: JJ | last post by:
I have a Make Table query which uses a date parameter. Each time the user runs the query they will be prompted for a date. The table which is created should be named based on the date which they...
2
by: Mark | last post by:
I have a FE/BD 2002 DB on a XP pro platform. I know this is ugly but it works for me...... A text file is produced from our Oracle WMS. (Average 20k records) A command button deletes all records...
0
by: Dave Hammond | last post by:
Hi All, I'm trying to use the slow-query-log (with --log-queries-not-using-indexes enabled) to determine if any queries need optimization, and have a few questions about some entries I'm...
2
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
27
by: MLH | last post by:
How can I turn the following into a make-table query? SELECT & " " & AS Recipient FROM tblVehicleJobs INNER JOIN tblAddnlOwnrs ON tblVehicleJobs.VehicleJobID = tblAddnlOwnrs.VehicleJobID WHERE...
3
by: jonceramic | last post by:
Hi All, I need to know the best way to set up a datawarehouse/materialized view for doing statistics/graphs in Access. My crosstabs and unions are getting too complicated to crunch in real...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.