| From: | "Jack Gao" <wei(at)gaofamily(dot)org> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: Is this a bug? |
| Date: | 2001-11-13 18:07:56 |
| Message-ID: | 9srnih$10qq$1@news.tht.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
"Carl van Tast" <vanTast(at)Pivot(dot)at> wrote in message
news:73t1vtk61pcsob9pa0p32a9eou3a31tolh(at)4ax(dot)com(dot)(dot)(dot)
> On Mon, 12 Nov 2001 21:20:44 -0800, "Jack Gao" <wei(at)gaofamily(dot)org>
> wrote:
>
> >Update tblUserConfig Set Value = '1' From tblUserConfig As a Join
> >tblConfigItem As b On a.ItemID = b.ID And b.Scope = 3 Where a.UserID = 1
And
> >b.Name = 'UserClassID';
> >
> >It always update all records in tblUserConfig table!!!
>
> Jack,
>
> don't include the table you want to update in the FROM clause. Just
> try:
>
> Update tblUserConfig
> Set Value = '1'
> From tblConfigItem As b
> Where tblUserConfig.ItemID = b.ID
> And b.Scope = 3
> And tblUserConfig.UserID = 1
> And b.Name = 'UserClassID';
>
> Kind regards
> Carl van Tast
So, I can't use JOIN in UPDATE?
Thanks for your reply
Jack
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marc Spitzer | 2001-11-13 18:18:34 | how do I update or insert efficently in postgres |
| Previous Message | Jason | 2001-11-13 16:43:12 | Insert values from one existing table into a new table. |