Counting in Dynamic Tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gavin

    #1

    Counting in Dynamic Tables

    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

  • strawberry

    #2
    Re: Counting in Dynamic Tables


    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(re servation_id*,s how,shownight)

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

    Comment

    Working...