G
Guest
Hello-
I've got a database to track the histories of individual tools, and want to
generate a report to show the lifetime history of each individual tool,
including all the times it’s been used and all the times it’s failed. Here's
how it's set up (note that the first column in each table is the primary key;
I have other fields with additional details, but this shows you the basic
structure):
Tools table (tracks the production of each tool):
tool_id production_date
tool1 production_date1
tool2 production_date2
tool3 production_date3
tool4 production_date4
usage table (tracks each time each tool is used):
use_id tool_id
use1 tool1
use2 tool2
use3 tool2
use4 tool4
use5 tool4
failures table (tracks failures for each tool):
failure_id tool_id
failure1 tool1
failure2 tool1
failure3 tool2
Note that any given tool can have zero or multiple use incidents with no
upper bound, as well as having zero or multiple failures with no upper bound.
What I need is a lifetime history of every individual tool, with production
date, every time it’s been used, and every time it’s failed. So the results
of my query should look like this, so that I can then easily generate a
report sorted by tool:
tool_id use_id failure_id production_date
tool1 (null) (null) production_date1
tool1 use1 (null) (null)
tool1 (null) failure1 (null)
tool1 (null) failure2 (null)
tool2 (null) (null) production_date2
tool2 use2 (null) (null)
tool2 use3 (null) (null)
tool2 (null) failure3 (null)
tool3 (null) (null) production_date3
tool4 (null) (null) production_date4
tool4 use4 (null) (null)
tool4 use5 (null) (null)
This is something that would be trivial in a spreadsheet, by simply copying
and pasting the 3 tables’ rows below each other, then moving the columns the
right, and finally sorting by tool_id. I need to do this in Access, though,
so that other people can generate the same query, and am having a hard time
of it. In particular, all the queries I try end up combining use_id and
failure_id on the same row in different combinations, when in reality they
are two completely separate incidents on separate dates.
Sorry about the long long-winded explanation, and thanks for your help.
Thanks,
David
I've got a database to track the histories of individual tools, and want to
generate a report to show the lifetime history of each individual tool,
including all the times it’s been used and all the times it’s failed. Here's
how it's set up (note that the first column in each table is the primary key;
I have other fields with additional details, but this shows you the basic
structure):
Tools table (tracks the production of each tool):
tool_id production_date
tool1 production_date1
tool2 production_date2
tool3 production_date3
tool4 production_date4
usage table (tracks each time each tool is used):
use_id tool_id
use1 tool1
use2 tool2
use3 tool2
use4 tool4
use5 tool4
failures table (tracks failures for each tool):
failure_id tool_id
failure1 tool1
failure2 tool1
failure3 tool2
Note that any given tool can have zero or multiple use incidents with no
upper bound, as well as having zero or multiple failures with no upper bound.
What I need is a lifetime history of every individual tool, with production
date, every time it’s been used, and every time it’s failed. So the results
of my query should look like this, so that I can then easily generate a
report sorted by tool:
tool_id use_id failure_id production_date
tool1 (null) (null) production_date1
tool1 use1 (null) (null)
tool1 (null) failure1 (null)
tool1 (null) failure2 (null)
tool2 (null) (null) production_date2
tool2 use2 (null) (null)
tool2 use3 (null) (null)
tool2 (null) failure3 (null)
tool3 (null) (null) production_date3
tool4 (null) (null) production_date4
tool4 use4 (null) (null)
tool4 use5 (null) (null)
This is something that would be trivial in a spreadsheet, by simply copying
and pasting the 3 tables’ rows below each other, then moving the columns the
right, and finally sorting by tool_id. I need to do this in Access, though,
so that other people can generate the same query, and am having a hard time
of it. In particular, all the queries I try end up combining use_id and
failure_id on the same row in different combinations, when in reality they
are two completely separate incidents on separate dates.
Sorry about the long long-winded explanation, and thanks for your help.
Thanks,
David