From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Madison Kelly <linux(at)alteeve(dot)com> |
Cc: | PgSQL General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Joined delete |
Date: | 2005-01-03 20:50:33 |
Message-ID: | 20050103205028.GA11443@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
You can't use LEFT JOINs or really any kind of explicit join in a
DELETE query (deficiency of the SQL standard). If you need a LEFT JOIN
you probably need a subselect, like:
DELETE FROM table WHERE primary_key IN
(SELECT primary_key FROM x LEFT JOIN y WHERE etc..)
or any of the equivalent forms...
Hope this helps,
On Mon, Jan 03, 2005 at 12:39:38AM -0500, Madison Kelly wrote:
> Hi all,
>
> After all the great help I got from you all I managed to finish what
> I was struggling with. The last thing I need to do should be pretty
> simple. :)
<snip>
> Which works perfectly. What I need to do though is instead of
> returning those value, I need to instead delete the matches. I tried:
>
> DELETE FROM file_set_1 a LEFT JOIN file_info_1 b ON
> a.fs_name=b.file_name AND a.fs_parent_dir=b.file_parent_dir AND
> a.fs_type=b.file_type WHERE b.file_name IS NULL;
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.
From | Date | Subject | |
---|---|---|---|
Next Message | Luis Neves | 2005-01-03 21:04:36 | Re: Postgresql website issues. |
Previous Message | Mike Nolan | 2005-01-03 20:40:17 | Re: Postgresql website issues. |