This is probably a very trivial question and I feel foolish in even posting
it, but I cannot seem to get it to work.

SCENARIO (abstracted):

Two tables, "summary" and "detail".  The schema of summary looks like:

id          int   serial sequential record id
collect_date      date  date the detail events were collected

The schema of detail looks like:

id          int   serial sequential record id
sum_id            int   the id of the parent record in the summary table
details           text  a particular event's details

The relationship is obvious.  If I want to extract all the detail records
for a particular date (2/5/05), I construct a query as follows:

SELECT * FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE
collect_date='2005-02-05';

Now... I want to *delete* all the detail records for a particular date, I
tried:

DELETE FROM detail JOIN summary ON (summary.id=detail.sum_id) WHERE
collect_date='2005-02-05';

But I keep getting a parser error.  Am I not allowed to use JOINs in a
DELETE statement, or am I just fat-fingering the SQL text somewhere.  If
I'm *not* allowed to use a JOIN with a DELETE, what is the best workaround?
I want to delete just the records in the detail table, and not its parent
summary record.

Thanks in advance for your help,
--- Steve
___________________________________________________________________________________

Steven Rosenstein
IT Architect/Developer | IBM Virtual Server Administration
Voice/FAX: 845-689-2064 | Cell: 646-345-6978 | Tieline: 930-6001
Text Messaging: 6463456978 @ mobile.mycingular.com
Email: srosenst @ us.ibm.com

"Learn from the mistakes of others because you can't live long enough to
make them all yourself." -- Eleanor Roosevelt


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to