|
Posted by strawberry on 11/09/06 00:24
Gavin wrote:
> Hi,
>
> I have a question that i think will be pretty easy for someone 'in the
> know' to answer, but as of yet i have been unable to find anything on
> google.
>
>
> Basically, i have a page that is an overview of a shows reservations.
> On it i have a dynamic table that shows all the nights in the system
> for a particular show. I'd like one of the fields on each row of the
> table to display the total of reservations made for that night. So each
>
> row would display the total reservations (i.e. rows in the related
> table) for the night it refers to, much like a message boards 'replies'
>
> count.
>
>
> Any help on this would be great, i've tried the count function but i
> cant seem to get it to work with a dynamic 'Where = ' value. Perhaps
> i'm doing something wrong.
>
>
> All help much appreciated.
>
>
> Thanks,
> Gavin
let's suppose the table looks like this
reservations(reservation_id*,show,shownight)
SELECT `shownight` , `show` , count( `reservation_id` ) AS attendance
FROM reservations
WHERE shownight = '2006-11-09'
GROUP BY `show` , `shownight`
ORDER BY `show` , `attendance`;
Navigation:
[Reply to this message]
|