473,412 Members | 4,519 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,412 software developers and data experts.

design question - getting info from 3 tables

View Poll Results: which option would you choose?
no triggers, just select with long WHERE clause 0 0%
action_history table, triggers, and simpler select 2 100.00%
something else 0 0%
Voters: 2. You may not vote on this poll

25
I have 3 tables with 6 different date fields:
- "problems" with creation_date
- "funding_requests" with request_date and 3 different approval dates
- "purchase_orders" with po_date

I would like to select the list of all problem names where at least one of the 6 dates fall within a particular range.

Should I:

1) build a select statement, joining the three tables together and
WHERE ((p.creation_date BETWEEN start_date AND end_date) OR
(fr.request_date BETWEEN start_date AND end_date) OR
(fr.approval_1 BETWEEN start_date AND end_date) OR
(fr.approval_2 BETWEEN start_date AND end_date) OR
(fr.approval_3 BETWEEN start_date AND end_date) OR
(po.po_date BETWEEN start_date AND end_date) OR

or
2) create an action_history table which would look like:
p_id | action | action_date
--------------------------
1212 | created | 1/1/2000
1212 | new fr | 1/1/2000
1212 | 1st appr | 1/1/2000
1212 | 2nd appr | 1/1/2000
1212 | 3rd appr | 1/1/2000
...

I would have to add triggers to my three tables to update action_history table for every update or insert.

Then I can just join tables problems and action_items with simple where clause:
WHERE ah.action_date BETWEEN start_date AND end_date


Which is better design? How would you do it?
Mar 25 '09 #1
0 1287

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Don Vaillancourt | last post by:
Hello all, Over the years as I design more database schemas the more I come up with patterns in database design. The more patterns I recognize the more I want to try to design some kind of...
2
by: BeZerK | last post by:
I am currently trying to design a vb.net application using a MS-Access database that will keep track of my home files. I want this application to assign a folder number to each new file based on...
2
by: deko | last post by:
This may be an easy question, but for some reason the multiple table design idea is throwing me. I'm trying to avoid using one large, wide table - so I've got multiple tables that hold different...
3
by: James Armstrong | last post by:
Hi all, (warning - long post ahead) I have been tasked with designing a database for my company which will store trade information (it is a financial firm). It will need to export this info...
6
by: Graham Pengelly | last post by:
Hi I'll try to spell out my problem as succinctly as possible... My database has a User table, an Organisation table, a Department table and a JobType table (amongst others) The...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
5
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
2
by: Jami Bradley | last post by:
I'm in need of some design suggestions! We have a fairly large DB with thousands of users accessing data throughout the day. I have been given the task of restructuring a core part of the web...
3
by: keri | last post by:
Hi, I am starting from scratch with a new database to manage bookings of units. The database will store customer info, unit info, bookings, payments etc. I have scetched a basic design and am...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.