Off the cuff, I would do something like this:
Candidate
---------------------------
id (int)
name (varchar)
parent_ID (int)
dependsOnParent (bit)
parent_ID would signify which Prez the VP is affiliated with.
dependsOnParent would signify if the child (VP) can run alone or not.
The query would be something like this:
SELECT p.ID,
p.name,
c.ID as Child_ID,
c.Name,
c.Parent_ID,
c.dependsOnParent
FROM Candidate p
LEFT OUTER JOIN Candidate c on (c.parent_ID = p.ID)
WHERE p.Parent_ID = 0
OR
(p.Parent_ID = 1 AND c.dependsOnParent = 0)
Something like that should work.
HTH,
Chris
>>> [EMAIL PROTECTED] 03/29/05 10:38AM >>>
I would like to get some opinions on how best to structure a simple
election database for my intranet site.
Most of the time, an election will have different offices, or positions,
for which candidates run. In these instances, there is one candidate
running for a position.
Every now and then, we have running partners like President and
Vice-President. In our elections, if you vote for a president or
vice-president, you get the running-mate as well.
So, to summarize:
Election Situation 1 (Everyone for himself):
Pres Candidates: Bill Fold v. Jim Nasium
Vice-Pres Candidates: Seymour Butts v. Harry Pitts
Election Situation 2 (Pre-defined running mates):
Pres/Vice-Pres Candidates: Bill Fold/Seymour Butts v. Jim Nasium/Harry
Pitts
I could just make "Bill Fold/Seymour Butts" the single candidate name,
but that doesn't lend itself to storing information about each running
mate.
I could store each candidate separately and then somehow group them
together as a single unit.
Any suggestions?
M!ke
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200494
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54