Board index » delphi » SQL query - how to limit number of users in a group

SQL query - how to limit number of users in a group

Hi All,

As a teacher I have written an app that records all the details for students
and what sport they take.  All this is stored in a single table.  There is
another table that reords the teacher details and what sports they
supervise.

This program has run successfully for several years, but now the sports
teacher wants it to limit the number of participants in each sport.

Does anyone have any suggestions as to how this may be done (preferably
simply :<))

Cheers & Beers

Cruickers

 

Re:SQL query - how to limit number of users in a group


Add a table that contains the maximum number for each sport. In a before
insert query select the maximum value then select count(*) for that sport
and compare the numbers. If you are at the limit raise an exception.

--
Bill
(TeamB cannot answer questions received via email)

Re:SQL query - how to limit number of users in a group


Bill,

Thanks for that - it seems a very simple way to tackle the problem - I
desparately lack experience in this field

Cheers & Beers

Cruickers

"Bill Todd (TeamB)" <f...@foo.com> wrote in message news:3c3eecd8_1@dnews...

Quote
> Add a table that contains the maximum number for each sport. In a before
> insert query select the maximum value then select count(*) for that sport
> and compare the numbers. If you are at the limit raise an exception.

> --
> Bill
> (TeamB cannot answer questions received via email)

Re:SQL query - how to limit number of users in a group


Sorry. That should have been, "in a before insert trigger...".

--
Bill
(TeamB cannot answer questions received via email)

Other Threads