473,387 Members | 1,553 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,387 software developers and data experts.

Table layout help required!!!

This might be simple or it might not...

I've got a table which stores items of equipment. Some items of equipment need servicing and they might need more than 1 type of service. So far I've come up with:

Table Name: [Equipment], PKey: [ItemID], Other fields as appropriate...
Table Name: [ServiceType], PKey: [ServiceTypeID], Description, Frequency
Table Name: [Service], PKey: [ServiceID], FKey: [ItemID], FKey: [ServiceTypeID]

Now what I want to do is store the results for each type of service in its own table (each service type will have different checks and therefore different results):

Table Name: [ServiceResultsForServiceTypeID1], PKey: [ServiceResultsID], FKey: [ItemID], DateTested, Results as appropriate...

Table Name: [ServiceResultsForServiceTypeID2], PKey: [ServiceResultsID], FKey: [ItemID], DateTested, Results as appropriate...

Now how do I join these result tables to the rest of the database? I thought about storing the table name for the results in a field in the ServiceType table but don't see how this'll work.

I hope I'm clear enough - let me know if this doesn't make sense.
Thanks in advance,
Matt.
Jul 21 '06 #1
3 1156
ronverdonk
4,258 Expert 4TB
1st. what is the reationale of having a separate 'ServiceResultsForService' tabel for each servicetype?
2nd I have no intention of patronizing, but let's make it easier and visualise the tables involved. That way it is easier to see relations and connections between tables and keys. Example:
Expand|Select|Wrap|Line Numbers
  1.   Equipment         ServiceType             Service               Service Results
  2. +-----------+    +---------------+    +---------------------+    +------------------+
  3. | ItemID    |    | ServiceTypeId |    | ServiceId           |    | ServiceResultsId |
  4. |  PKEY     |    |   PKEY        |    |  PKEY               |    |    PKEY          |
  5. |-----------|    |---------------|    |---------------------|    |------------------|
  6. | other ... |    | Descr, freq...|    | ItemId        FKEY  |    | ItemId    FKEY   |
  7. |-----------|    |---------------|    |---------------------|    |------------------|
  8. |           |    |               |    | ServiceTypeId FKEY  |    |                  |
  9. |-----------|    |---------------|    |---------------------|    |------------------|
  10. |           |    |               |    |                     |    |                  |
  11. +-----------+    +---------------+    +---------------------+    +------------------+
Now you are able to draw (with a pen) those connections. If you cannot connect a table to any of the other ones, you must insert a field in that table that will make that possible.

Get back when you are done.

Ronald :cool:
Jul 21 '06 #2
comteck
179 100+
Just two question.
1. What data type are you using for your Primary Keys and Foreign Keys in each of the tables?
2. What kind of relationship is set up between the tables?

comteck
Jul 21 '06 #3
Just a guess... but you might try creating a view on top of all of your tables.

CREATE VIEW ServiceResultsForServiceType as
(SELECT * FROM ServiceResultsForServiceTypeID1)
UNION
(SELECT * FROM ServiceResultsForServiceTypeID2)
UNION
...
UNION
(SELECT * FROM ServiceResultsForServiceTypeIDn)
Aug 4 '06 #4

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

Similar topics

28
by: Anthony Williams | last post by:
Good morning, I'm currently designing a site, using CSS, and wish to create a variable width two-column layout, with header and footer, and one fixed-width column on the left. Previously, I...
47
by: Neal | last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A quite good article.
4
by: Rob Freundlich | last post by:
I have some servlet-generated tabular data that I need to present, so I'm using an HTML Table. In some cases, it can be quite large. I'm flushing the servlet output every N lines to push the data...
4
by: Eric | last post by:
I'm trying to reproduce the following table layout using CSS only and am having some trouble with it. I'd like them to look identical but I'm having trouble sizing the labels properly as it doesnt...
2
by: Wayne Wengert | last post by:
I have an aspx page I originzlly built in WebMatrix that includes a "<table>" structure to layout the columns using "<tr>" and "<td>" elements (see sample below). When I create a new aspx form in...
4
by: greg.mckone | last post by:
Hi folks, I've been using CSS for style for several years now, but I've never attempted a layout using CSS. (I'd like to move away from tables) I'm working on a page here:...
3
by: Roberto Roachling | last post by:
Hello, Converting a table layout to a div layout. The navbar is giving me some trouble. div link: http://gertrudischale.com/essay.pl.htm (slightly incomplete, but illustrates problem) table...
8
by: sethp | last post by:
I have a question about table layout in IE. I have a table with two columns. The left column has two rows and the right column has 1 row that has a column span of 2. In the left column I have...
2
by: spacix | last post by:
Does anyone know a work around for "table-layout: fixed;" to prevent the automatic evenly space cells width without assigning classes or ID to cells? My program prints a HTML "report" file and I...
5
by: Timothy Larson | last post by:
I'm trying to create a 3 row layout in which each row will have two blocks, BUT I want the width of these blocks to be independent of the blocks in the other rows. So AFAICT a regular table layout...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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
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
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,...

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.