Constraining future rows based on past rows

Поиск
Список
Период
Сортировка
Искать

Constraining future rows based on past rows

От:
Ketema Harris <ketema@gmail.com>
Дата:
Вложения:

I have a query in which I want to limit future rows of the result set based on data in a row that has already been returned.  Is this possible?

Example:

 company_id | city_id |      date_time      | weekday  | hour_of_day | company_name |  city  | max_bookings | currently_booked
------------+---------+---------------------+----------+-------------+--------------+--------+--------------+------------------
          1 |       1 | 2006-04-20 15:30:00 | thursday | 03:30 pm    | EFT         | Dallas |            5 |                1
          1 |       1 |                     | monday   | 11:00 am    | EFT          | Dallas |            4 |                0
          1 |       1 |                     | thursday | 09:00 am    | EFT          | Dallas |            3 |                0
          1 |       1 |                     | thursday | 10:00 am    | EFT          | Dallas |            6 |                0
          1 |       1 |                     | thursday | 01:00 pm    | EFT          | Dallas |            7 |                0
          1 |       1 |                     | thursday | 03:30 pm    | EFT          | Dallas |            7 |                0

The above result set is returned from a query.  The last row matches the first, on the day of the week and the time, it just does not have a specific date.  How would I drop that row, but only when the first row is present?  Is this possible?


Extra info is attached.

Thanks,

Ketema
FAQ