Re: Help with a COUNT / SELECT query
| From: | Shaun | Date: | Fri, 23 Jan 2004 21:05:22 +0000 |
| Subject: | Re: Help with a COUNT / SELECT query | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32608@lists.php.net to get a copy of this message | ||
Thanks for your reply,
but that only tells me how many complete Bookings there are. I need to know
how many Areas are complete i.e. for each Area where Bookings take place,
all of those Bookings have been completed.
Any ideas?
"Oòvn?Oòsis" <martin@bugs.unl.edu.ar> wrote in message
news:1074891125.4011897544054@bugs.unl.edu.ar...
> Mensaje citado por Shaun <shaun@mania.plus.com>:
>
> > 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?
>
> SELECT count(*) FROM WMS_Bookings WHERE Booking_Status = 2;
>
> Saludos... :-)
>
> > 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
> >
>
>
> --
> select 'mmarques' || '@' || 'unl.edu.ar' AS email;
> -------------------------------------------------------
> Martín Marqués | Programador, DBA
> Centro de Telemática | Administrador
> Universidad Nacional
> del Litoral
> -------------------------------------------------------