I would make the following change to you schema. Since # of dogs in a ring can be calculated and you say that end_time is detirmined by the # of dogs.
create table ring_event (
ring_event_id integer,
event_name varchar(20)
ring_id integer references ring(ring_id),
start_time time,
time_per_dog time,
);
-- you can then use
select a.ring_event_id, a.event_name,
a.ring_id, a.start_time,
ADDTIME(a.start_time, time_per_dog * count(b.dog_id))
as end_time, count(b.dog_id) as num_dogs
from ring_event a, tda b
where a.ring_event_id = b.ring_event_id
group by a.ring_event_id;
-- to get the end_time and number of dogs.
A picture is worth a thousand words, but takes 200K.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.