Re: What is wrong with this SQL

From: "Chad Thompson" <chad(at)weblinkservices(dot)com>
To: "Patrick Hatcher" <PHatcher(at)macys(dot)com>, "pgsql-novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: What is wrong with this SQL
Date: 2002-08-14 20:24:16
Message-ID: 010801c243d0$91ac6c50$32021aac@chad
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

could it be that you want this?

update price
set price.price = 200
where(price RIGHT JOIN product ON price.product = product.id) as price RIGHT
JOIN
supplier ON product.supplier = supplier.id
WHERE (((supplier.id)=4) AND ((supplier.status)=1) AND
((product.status)=1) AND ((price.type)=1) AND ((product.id)=100902));

Im not sure if this works, but it should start you down the correct road.

Thanks
Chad
----- Original Message -----
From: "Patrick Hatcher" <PHatcher(at)macys(dot)com>
To: <norman(at)khine(dot)net>
Cc: "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>;
<pgsql-novice-owner(at)postgresql(dot)org>
Sent: Wednesday, August 14, 2002 2:13 PM
Subject: Re: [NOVICE] What is wrong with this SQL

>
> It appears you aren't updating any fields (or I'm looking at it wrong):
>
> UPDATE SOME_TABLE
> SET FIELD1 = SOME_VALUE
> From
> (price RIGHT JOIN product ON price.product = product.id) RIGHT JOIN
> supplier ON product.supplier = supplier.id SET price.price = 200
> WHERE (((supplier.id)=4) AND ((supplier.status)=1) AND
> ((product.status)=1) AND ((price.type)=1) AND ((product.id)=100902));
>
>
> Patrick Hatcher
>
>
>
>
> |--------+--------------------------------->
> | | "Norman Khine" |
> | | <norman(at)khine(dot)net> |
> | | Sent by: |
> | | pgsql-novice-owner(at)post|
> | | gresql.org |
> | | |
> | | |
> | | 08/14/2002 12:56 PM |
> |--------+--------------------------------->
>
>---------------------------------------------------------------------------
-------------------------------|
> |
|
> | To: "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>
|
> | cc:
|
> | Subject: [NOVICE] What is wrong with this SQL
|
>
>---------------------------------------------------------------------------
-------------------------------|
>
>
>
>
> Hello,
> I am a bit stuck on this UPDATE query
>
> UPDATE (price RIGHT JOIN product ON price.product = product.id) RIGHT JOIN
> supplier ON product.supplier = supplier.id SET price.price = 200
> WHERE (((supplier.id)=4) AND ((supplier.status)=1) AND
> ((product.status)=1) AND ((price.type)=1) AND ((product.id)=100902));
>
> This works.... but the above query gets a exception error "("
>
> SELECT supplier.id, price.price, product.id FROM (price RIGHT JOIN
> product ON price.product = product.id) RIGHT JOIN supplier ON
> product.supplier = supplier.id WHERE (((su
> pplier.id)=4) AND ((supplier.status)=1) AND ((product.status)=1) AND
> ((price.type)=1) AND ((product.id)=100902));
>
> Thanks
>
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
> zz/********/z/****\zzz|****\*\zz|*******|z
> z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine
> zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman(at)khine(dot)net
> zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley
> z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK
> zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz
> zz/******/zz\******/zz|*|zzzzzzz|*|*****|z
> z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Norman Khine 2002-08-14 23:14:55 Re: What is wrong with this SQL
Previous Message Oliver Elphick 2002-08-14 20:14:54 Re: I need to know password for postgres