Counting in Dynamic Tables

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

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'


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.  


Re: Counting in Dynamic Tables

Gavin wrote:
Quoted text here. Click to load it

let's suppose the table looks like this


SELECT `shownight` , `show` , count( `reservation_id` ) AS attendance
FROM reservations
WHERE shownight = '2006-11-09'
GROUP BY `show` , `shownight`
ORDER BY `show` , `attendance`;

Site Timeline