All,

I am presently accomplishing this problem in code but was wondering if I can
have MySQL do the heavy lifting instead and get the advantage of sorting and
whatnot.

I have basically the following layout in my document tracking system to
define various categories and then populate them with entries:

To define the various sections I have the following table (simplified for
discussion):

-[ SectionTypes Table ]-
SectionID
SectionDescription

To define the column(s) belonging to the section; I have a table like below:
(A given section can 1+ columns, realistically never more than 10-15 columns
though)
-[ SectionColumnTypes Table ]-
SColumnID
SectionID
ColumnTitle


I then use two tables to track the data:

First table represents a single entry under a given Section, no real details
just a linkup
-[ Documents Table ]-
DocID
SectionID

Second table represents the column entries
-[ DocumentColumns Table ]-
DColumnsID
DocID
SColumnID
Value



In code I am pulling this into a grid with a given row being:
DocID | Value.1 | Value.N...

For a given SectionType I would like to determine the number of columns
(based on the SectionColumnTypes table) and then populate rows for each
Documents table entry with the DocumentColumns values pulled into columns
(as shown above).


Is this possible?

Should I re-think my database layout to make it possible?

Should I just do it in code?


Thanks for any assistance and sorry for the long message; I can't think of a
more succinct way to describe the issue.

-Geoff

Reply via email to