Subject | Re: Small Update SQL trick (problem) |
---|---|
Author | majstoru |
Post date | 2005-12-27T11:48:01Z |
Hi Adam,
I'll try simplier.
SET Article.Price = (SELECT Price FROM Document WHERE Document.Article
= Article.id);
My SQL shoul be work like this:
for i := 1 to Document.recordcount
begin
UPDATE Article SET Article.Price = (SELECT Price FROM Document WHERE
Document.Article = Article.id);
end
Is this posible in one SQL statment.
P.S. My english is vey bad, but I'm trying to represent my problem
with Delphi code below!
Thanks again
I'll try simplier.
> > Here is sample data:SQL that I need must upade price from table document UPDATE Article
> > Article
> > id name price
> > 1 name1 10.00
> > 2 name2 20.00
> > 3 name3 30.00
> >
> > Document
> > article qty newprice
> > 1 10 15.00
> > 2 10 25.00
> > 3 10 35.00
> >
SET Article.Price = (SELECT Price FROM Document WHERE Document.Article
= Article.id);
My SQL shoul be work like this:
for i := 1 to Document.recordcount
begin
UPDATE Article SET Article.Price = (SELECT Price FROM Document WHERE
Document.Article = Article.id);
end
Is this posible in one SQL statment.
P.S. My english is vey bad, but I'm trying to represent my problem
with Delphi code below!
Thanks again