Subject | Re: Small Update SQL trick (problem) |
---|---|
Author | majstoru |
Post date | 2005-12-27T01:20:18Z |
Hi Adam,
First, thanks for help!
Let me to give you a real primer! I have a table article with some
records (structure id, name, price) and I have a Document table that
is updating article price (price calculation) (structure article, qty,
newprice)!
Here is sample data:
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
And that is data. Now I need SQL that will update all prices from
Document into the Article table (fex: Article 1, price 10 UPDATED to
price 15), in Delphi:
for i := 1 to document.recordcout do
begin
if article.locate('id', document.fieldbyname('article').asstring, [
]) then
// update procedure
end;
all these functions, if it is possible in one SQL, without SP.
Why not SP. I have SQL's for some functions in my application and this
is one small problem which I have to complete all client request!
Thanks again for ultra fast reply!
First, thanks for help!
Let me to give you a real primer! I have a table article with some
records (structure id, name, price) and I have a Document table that
is updating article price (price calculation) (structure article, qty,
newprice)!
Here is sample data:
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
And that is data. Now I need SQL that will update all prices from
Document into the Article table (fex: Article 1, price 10 UPDATED to
price 15), in Delphi:
for i := 1 to document.recordcout do
begin
if article.locate('id', document.fieldbyname('article').asstring, [
]) then
// update procedure
end;
all these functions, if it is possible in one SQL, without SP.
Why not SP. I have SQL's for some functions in my application and this
is one small problem which I have to complete all client request!
Thanks again for ultra fast reply!