From: | Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
---|---|
To: | frbn <frbn(at)efbs-seafrigo(dot)fr> |
Cc: | Dorward Villaruz <dorwardv(at)ntsp(dot)nec(dot)co(dot)jp>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: deletion of records |
Date: | 2002-07-12 10:05:53 |
Message-ID: | 20020712110553.A23232@quartz.newn.cam.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Jul 12, 2002 at 09:38:39AM +0200, frbn wrote:
> DELETE FROM custinfo,custinfotemp
> WHERE
> custinfo.UserID=custinfotemp.userid
> and
> custinfotemp.updateStatus='D'
> ;
> should avoid the 2.10^6 selects
Won't that delete rows from custinfotemp too?
Patrick
> Dorward Villaruz a écrit:
> >can anybody help me with this one
> >
> >i want to delete rows from one table based values from another table.
> >
> >here is the scenario
> >
> >i have a table named custinfo which contain 2000000 records and a table
> >custinfotemp which contain 30000 records. i want to delete all records
> >in custinfo where the cust_id is found on custinfotemp where it's update
> >status is 'D'
> >
> >here is my sql statement
> >
> >psql -h $HOSTNAME -d $DBNAME -c "DELETE FROM custinfo WHERE
> >custinfo.UserID IN (SELECT custinfotemp.userid FROM custinfotemp where
> >updateStatus='D')";
From | Date | Subject | |
---|---|---|---|
Next Message | Uros Gruber | 2002-07-12 10:08:19 | Re: What is better any why |
Previous Message | philip johnson | 2002-07-12 10:02:16 | Re: PostgreSQL / Reporting tool |