Calculating of Start Time for TV Impressions
kdwolfMar 10 2009 — edited Mar 10 2009I need a help to calculate the right time of some TV Impressions. I thought of using a Model, but...
Here is the case: we have Promotional Breaks between the TV Programmes, each Break has its own start time and within each Break there is a list of Impressions (f.e. promos ) with their respective sequential number, but no Start Time. I need a help to find out the best way to calculate it, PLEASE!
WITH promo_breaks AS (SELECT 1 AS promo_break_id,
36000 AS promo_break_start_time_in_sec
FROM dual),
impressions AS (SELECT 100 AS impression_id,
1 AS promo_break_id,
60 AS imp_duration_in_sec,
1 AS seq_number
FROM dual
UNION ALL
SELECT 101 AS impression_id,
1 AS promo_break_id,
30 AS imp_duration_in_sec,
2 AS seq_number
FROM dual)
SELECT i.impression_id,
b.promo_break_start_time_in_sec,
i.seq_number, --- I WANT TO HAVE ITS START TIME INSTEAD
i.imp_duration_in_sec
FROM impressions i
JOIN promo_breaks b
ON i.promo_break_id = b.promo_break_id