samedi 16 juillet 2016

each event in table 1 has timestamp. Find all transactions in table 2 that started before and finished after

I am looking for a SELECT statement that takes Tables 1 and 2 and generates Table 3 with the following properties.

Table 1: event_id | customer_id | timestamp Table 2: transaction_id | time_started | time_finished

(Desired) Table 3: for each customer, specifies all transactions that were active when the customer performed an event described in table 1. The transaction is considered active if it started before an event and finished after it. The format of table 3:

customer_id | transaction_id

Application area: I need to understand which requests were outstanding when a supplier logged in to the marketplace.

Aucun commentaire:

Enregistrer un commentaire