macromedia.dreamweaver.appdev
[Top] [All Lists]

Couting groups of records and showing information based on the count

Subject: Couting groups of records and showing information based on the count
From: "jennivazquez"
Date: Tue, 23 Oct 2007 04:12:09 +0000 UTC
Newsgroups: macromedia.dreamweaver.appdev

Hi --

 I have a situation in which I need to make registration available for a series 
of programs, but only until there are 16 registrants in a program; once 16 
registrants have signed up for a program, that program is no longer available. 

 I want to show only the available programs, grouped by program category (there 
are two categories).  I also want to show a message ("Sorry, this program is 
full") when the number of registrants has been reached. 

 I have a recordset that finds only the available programs, but I do not know 
how to group them by category, or how to show the "Sorry" message.   Any help 
would be appreciated.  Follows are the abbreviated table structures in question 
and the recordset I currently have in place that shows all the programs with 
fewer than 16 registrants:  

 Table1: LocationPrograms
 ProgLocID - primary key
 LocCat - Location Category
 LocNme - Location Name

 Table 2: Registrants
 ID - primary key
 ProgLocID_FK - Foriegn key referencing the primary key in TBL LocationPrograms
 Name - Name of registrant
 ProgramALL - Name of the Program the Registrant signed up for

 SELECT LocNme
 FROM LocationPrograms   
 LEFT OUTER JOIN Registrants 
 ON LocationPrograms.LocNme = Registrants.ProgramALL  
 GROUP BY LocationPrograms.LocNme  
 HAVING COUNT(LocationPrograms.LocNme) < 16


<Prev in Thread] Current Thread [Next in Thread>
  • Couting groups of records and showing information based on the count, jennivazquez <=