Hi,

I have a Bookings application. When a Booking is made it is entered in to
the Bookings table. Bookings take place at Areas, held in the Areas table.
Each Area has a unique Area_ID held in the Bookings table for each Booking.
Each Booking needs to be completed and when done so the Booking_Status for
each Booking is updated to '2'. An Area is complete when all Bookings at
that
Area have been completed. How can I run a query that tells me how many
completed Areas there are in the system?

Thanks for your help

CREATE TABLE WMS_Bookings (
  Booking_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  User_ID int(11)  DEFAULT '0' NOT NULL ,
  Project_ID int(11)  DEFAULT '0' NOT NULL ,
  Area_ID int(11)  DEFAULT '0' NOT NULL ,
  Booking_Start_Date datetime  DEFAULT '0000-00-00 00:00:00' NOT NULL ,
  Booking_End_Date datetime  DEFAULT '0000-00-00 00:00:00' NOT NULL ,
  Booking_Completion_Date date    ,
  Booking_Status int(2)  DEFAULT '0' NOT NULL ,
  Additional_Notes text    ,
  PRIMARY KEY (Booking_ID)
);

CREATE TABLE WMS_Area (
  Area_ID int(11)  DEFAULT '' NOT NULL auto_increment,
  Area_Name varchar(40)  DEFAULT '' NOT NULL ,
  Area_Address varchar(255)  DEFAULT '' NOT NULL ,
  Area_Postcode varchar(10)  DEFAULT '' NOT NULL ,
  Area_Telephone varchar(15)  DEFAULT '' NOT NULL ,
  PRIMARY KEY (Area_ID)
);

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to