help deleting obsolete records

Поиск
Список
Период
Сортировка
От Frank Bax
Тема help deleting obsolete records
Дата
Msg-id 5.1.1.6.0.20021015145821.02d52070@pop6.sympatico.ca
обсуждение исходный текст
Ответы Re: help deleting obsolete records  (Frank Bax <fbax@sympatico.ca>)
Список pgsql-novice
I don't know how to write an SQL for the following:

Table "teamwork"
  Attribute |           Type       |  Modifier
-----------+----------------------+-------------
  team      | character varying(8) | not null
  emp       | character varying(2) | not null

Table "timesheet"
  Attribute |           Type           |  Modifier
-----------+--------------------------+-------------
  emp       | character varying(8)     | not null
  team      | character varying(2)     | not null
  lo_shift  | timestamp with time zone |
  hi_shift  | timestamp with time zone |

Consider a subset of data from timesheet which meets the condition:
         lo_shift > (now()-'30days'::interval)
Now I want to delete all rows from teamwork where the data pair "emp,team"
is *not* in the subset of data retrieved from timesheet.  It is possible
that timesheet will contain multiple rows for any given emp,team pair.

Frank


В списке pgsql-novice по дате отправления:

Предыдущее
От: Thad Humphries
Дата:
Сообщение: ECPG fails to handle hex constants
Следующее
От: Thad Humphries
Дата:
Сообщение: where are the error codes?