SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: getting totals

  1. #1
    SitePoint Guru
    Join Date
    Dec 2001
    Location
    San Diego, CA
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    getting totals

    I have a ticketing system that I get paid per ticket. Every entry in the database is a purchase, however each purchase can have many tickets. Whenever a ticket is purchased, it gets timestamped.

    tickets
    --------------
    ticket_id
    ticket_concert_id
    ticket_total
    ticket_time

    That is the structure that concerns this (there are more things but are not necessary to this goal). So one purchase could have any number of tickets.

    I want to display the total TICKETS purchased for each month, as I get paid at the end of every month.

    In my previous post I only totalled the amount of purchases and not the total tickets.

  2. #2
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    select DATE_FORMAT(ticket_timesum,'%Y-%m') dateFormated, sum(ticket_total) totalTickets from tickets group by dateFormated


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •