good point, John... I wondered about normalization myself...
Fletcher, the answer I provided would combine all the values into one
field on the same record -- that is probably NOT what you want to
do...combining seperate data is never a good idea because you can always
combine it for reporting...
To build on what John said, you can define another table
*Measurements*
MeasID, autonumber
MeasDate, date
Measurement, number
(if it is not a whole number, make sure to change the size to something
appropriate like single or double)
NOTE: if Measurement is calculated, it should not be stored
I left out TIME since date and time can (and should) be stored together
apparently, you have 3 samples (or more or less) that the measurement is
based upon... which leads me to a question: is Measurement the average
of your Samples? If so, it should not be stored as it can be calculated
anytime. If Sample1, Sample2, Sample3 are sample numbers, or some other
identifier, then it is ok to be storing Measurement
You will now have a RELATED table with the sample info:
*Samples*
SampleID, autonumber
MeasID, Long Integer -- corresponds to MeasID in Measurements
Sample -- don't know what your data type is...
John gave you the SQL to combine all the values, but not to actually
transfer that to another table...
In order to help you further, we need to know exactly what Measurement
and Sample1, Sample2, Sample 3 actually are... and this will affect. of
course, the table structure I gave you
Warm Regards,
Crystal
*
have an awesome day
*
MVP Access
Remote programming and Training
strive4peace2006 at yahoo.com
*
John Vinson wrote:
Is there a query or command somehwere that will take, say, six columns
and combine them into one column, but keep associated data the same?
To give a simple expample, lets say I have a table with a DATE, TIME,
MEASUREMENT, and three columns called SAMPLE1, SAMPLE2, SAMPLE3.
I would like the three sample columns to combine to a single column but
keep the DATE, TIME, and MEASUREMENT that was associated with it in the
first place.
If anyone could help me with this, I would greatly appreciate it.
Thanks
I'm not absolutely clear what you want here. Do you want to take the
100 records in this table and generate 300 records with each different
SAMPLE value as a single field? If so, a "Normalizing Union Query"
would be the way to go. You'll need to go into SQL view to do it, you
can't do it in the grid. In your example:
SELECT [DATE], [TIME], MEASUREMENT, [SAMPLE1] AS SAMPLE
FROM yourtable
WHERE [SAMPLE1] IS NOT NULL
UNION ALL
SELECT [DATE], [TIME], MEASUREMENT, [SAMPLE2]
FROM yourtable
WHERE [SAMPLE2] IS NOT NULL
UNION ALL
SELECT [DATE], [TIME], MEASUREMENT, [SAMPLE3]
FROM yourtable
WHERE [SAMPLE3] IS NOT NULL;
Note a couple of things: DATE and TIME are reserved words, for the
built-in date and time functions, and are not good choices of
fieldnames; and if you're storing the date in one field and the time
in another, you may want to reconsider; you can store both in a single
Date/Time field and find it easier to sort and search.
John W. Vinson[MVP]