Subject | UPDATE problem |
---|---|
Author | Ben Johnson |
Post date | 2003-06-02T11:20:15Z |
Hi,
I have two tables, product and temp with the following
structures
product
-------
id integer NOT NULL (PK)
desc varchar(50) NOT NULL
stock integer NOT NULL
rate decimal( 8, 2) NOT NULL
rate tax( 5, 2) NOT NULL
temp
----
product_id integer NOT NULL (PK)
stock integer NOT NULL
temp table contains a few products with stock. When I try to
run the following SQL statment it returns NULL ERROR in
column stock.
UPDATE product P
SET P.stock = (select T.stock from temp T
where P.id = T.product_id) ;
Is the statment is trying to update stock in table product
with null values for products which does not exist in table
temp ? If it is, is there a work around ?
Ben
___________________________________________________
Get email that means BUSINESS! me @ mycompany.com.
Just Rs.1499/year.
To start, click http://www.rediffmailpro.com
I have two tables, product and temp with the following
structures
product
-------
id integer NOT NULL (PK)
desc varchar(50) NOT NULL
stock integer NOT NULL
rate decimal( 8, 2) NOT NULL
rate tax( 5, 2) NOT NULL
temp
----
product_id integer NOT NULL (PK)
stock integer NOT NULL
temp table contains a few products with stock. When I try to
run the following SQL statment it returns NULL ERROR in
column stock.
UPDATE product P
SET P.stock = (select T.stock from temp T
where P.id = T.product_id) ;
Is the statment is trying to update stock in table product
with null values for products which does not exist in table
temp ? If it is, is there a work around ?
Ben
___________________________________________________
Get email that means BUSINESS! me @ mycompany.com.
Just Rs.1499/year.
To start, click http://www.rediffmailpro.com