A
anthony.carter
Hi,
The following reply from Jason Lepack to a previous question sets out
how to normalise a design:
"A normalized design, if you're interested, is
to have 3 tables.
tbl_unit: (info about the unit)
unit_id - autonumber - PK
unit_name - text
anything else about the unit
tbl_test: (info about the test)
test_id - autonumber - PK
test_name - text
anythign else about the test
tbl_unit_test: (test of a unit)
unit_id - number - FK - PK
test_id - number - FK - PK
unit_test_datetime - date/time - PK
unit_test_result_value
Then when you wanted to get results of all tests with a result_value
less than 4 you would use a query like this:
SELECT U.unit_name,
T.test_name,
UT.unit_test_datetime
FROM tbl_unit_test as UT
INNER JOIN tbl_unit as U
ON U.unit_id = UT.unit_id
INNER JOIN tbl_test as T
ON Y.test_id = UT.test_id
WHERE unit_test_result_value < 4 "
In the third table 'tbl_unit_test' there are two fields
'unit_id_number' and 'test_id_number'. Are these meant to be the same
as the unit_id_autonumber in table One (tbl_unit) and
test_id_autonumber in table Two (tbl_test)? If so, how are they
related ie. how would the id number in table Three be made to be the
same as in table One or Two?
Let me explain my my naivete another way.
Id numbers in the first two tables are generated automatically. When
it comes to entering the id numbers for the unit and test in the third
table how do I know what number to enter?
Thanks, Regards,
TC
The following reply from Jason Lepack to a previous question sets out
how to normalise a design:
"A normalized design, if you're interested, is
to have 3 tables.
tbl_unit: (info about the unit)
unit_id - autonumber - PK
unit_name - text
anything else about the unit
tbl_test: (info about the test)
test_id - autonumber - PK
test_name - text
anythign else about the test
tbl_unit_test: (test of a unit)
unit_id - number - FK - PK
test_id - number - FK - PK
unit_test_datetime - date/time - PK
unit_test_result_value
Then when you wanted to get results of all tests with a result_value
less than 4 you would use a query like this:
SELECT U.unit_name,
T.test_name,
UT.unit_test_datetime
FROM tbl_unit_test as UT
INNER JOIN tbl_unit as U
ON U.unit_id = UT.unit_id
INNER JOIN tbl_test as T
ON Y.test_id = UT.test_id
WHERE unit_test_result_value < 4 "
In the third table 'tbl_unit_test' there are two fields
'unit_id_number' and 'test_id_number'. Are these meant to be the same
as the unit_id_autonumber in table One (tbl_unit) and
test_id_autonumber in table Two (tbl_test)? If so, how are they
related ie. how would the id number in table Three be made to be the
same as in table One or Two?
Let me explain my my naivete another way.
Id numbers in the first two tables are generated automatically. When
it comes to entering the id numbers for the unit and test in the third
table how do I know what number to enter?
Thanks, Regards,
TC