From: | "Tomasz Myrta" <jasiek(at)klaster(dot)net> |
---|---|
To: | wahab(at)mimos(dot)my, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: How to delete duplicate record |
Date: | 2003-02-09 23:17:18 |
Message-ID: | 20030210071718.M78570@klaster.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
> How do I delete a duplicated records?
> Here I've 7 duplicated records and tried to delete 6 from them.
>
> I tried this query but has error
> b2b=> delete from biztypes where bizid = (select bizid from biztypes
> where bizid = 'B116' limit 6);
> ERROR: More than one tuple returned by a subselect used as an
> expression.
>
> I tried this query, but all records are deleted.
> b2b=> delete from biztypes where bizid = (select bizid from biztypes
> where bizid = 'B116' limit 1);
> DELETE 7
>
> Any help are very much appreciated..
> Thanks. Wahab
Try this:
delete from biztypes where exists (select * from biztypes b2 where
biztypes.bizid=b2.bizid)
Regards,
Tomasz Myrta
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Myrta | 2003-02-10 00:36:47 | Re: How to delete duplicate record |
Previous Message | Tomasz Myrta | 2003-02-09 23:12:11 | Re: order by date desc but NULLs last |