Re: Joined deletes but one table being a subquery.

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Rajesh Kumar Mallah <mallah(at)trade-india(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Joined deletes but one table being a subquery.
Date: 2003-08-25 05:59:59
Message-ID: 3F49A5DF.1040405@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> I apologize for the silence.
>
> t_a as been created as
>
> CREATE TABLE t_a as SELECT userid,category_id from eyp_listing where userid=21742 and size ilike '%WEBFL%'
> EXCEPT SELECT userid,category_id from company_export_profile where userid=21742 ;
>
> so the subquery is basically
>
> ( SELECT userid,category_id from eyp_listing where userid=21742 and
> size ilike '%WEBFL%' EXCEPT SELECT userid,category_id from company_export_profile
> where userid=21742 )
>
>
> regds
> mallah.
What about this?
delete from eyp_listing where exists (select * from
eyp_listing el
left join company_export ce using (userid,category_id)
where el.userid=21742 and size ilike '%WEBFL%' and ce.userid is null
and el.userid=eyp_listing.userid
and el.category_id=eyp_listing.category_id);

It should be solution, but not the answer for your question...
How did you use that sub-select, so it didn't work?

Regards,
Tomasz Myrta

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michele Bendazzoli 2003-08-25 07:12:27 Re: [ZODB-Dev] What are the ZopeDB limit?
Previous Message Tom Lane 2003-08-24 21:38:16 Re: "SELECT IN" Still Broken in 7.4b