Querying Unsold Seats

Hello,


We are conducting an analysis on sales trends for a large hall scaling project. As part of this analysis, we are interested in also including all of the unsold seat locations. I am wondering if someone has queried unsold seats from the database before, and what were the best tables to approach this. I am leaning towards using the seat status, but wondering if that's the best way to approach it. 

Thank you!

Sarah

Parents
  • Here's some code you can start with.  It applies to just one particular performance id (perf_no).

    --find seats of a certain status for a given perf_no
    SELECT ps.perf_no
    , ps.seat_status
    , ss.description as seat_status_desc
    , z.description as zone
    , se.description as section2
    , s.section
    , s.seat_row as seat_row
    , s.seat_num as seat_num
    , ps.seat_no
    FROM tx_perf_seat ps
    JOIN tr_seat_status ss on ps.seat_status = ss.id
    JOIN t_zone z on ps.zone_no = z.zone_no
    JOIN t_seat s on ps.seat_no = s.seat_no
    JOIN tr_section se on s.section = se.id
    WHERE 1 = 1
    AND ps.seat_status = 0 --0 is Available
    AND ps.perf_no = 3950 --Your Perf no goes here
    ORDER BY z.description, se.description, s.seat_row, convert(int, s.seat_num)

Reply
  • Here's some code you can start with.  It applies to just one particular performance id (perf_no).

    --find seats of a certain status for a given perf_no
    SELECT ps.perf_no
    , ps.seat_status
    , ss.description as seat_status_desc
    , z.description as zone
    , se.description as section2
    , s.section
    , s.seat_row as seat_row
    , s.seat_num as seat_num
    , ps.seat_no
    FROM tx_perf_seat ps
    JOIN tr_seat_status ss on ps.seat_status = ss.id
    JOIN t_zone z on ps.zone_no = z.zone_no
    JOIN t_seat s on ps.seat_no = s.seat_no
    JOIN tr_section se on s.section = se.id
    WHERE 1 = 1
    AND ps.seat_status = 0 --0 is Available
    AND ps.perf_no = 3950 --Your Perf no goes here
    ORDER BY z.description, se.description, s.seat_row, convert(int, s.seat_num)

Children