Subject | Re: Small Update SQL trick (problem) |
---|---|
Author | majstoru |
Post date | 2005-12-27T08:35:07Z |
Hi,
--- In firebird-support@yahoogroups.com, "ibrahim bulut"
<i.bulut@i...> wrote:
repeat query n time (n is a nuber of records in the orders table) in
one SQL statment.
Thanks
--- In firebird-support@yahoogroups.com, "ibrahim bulut"
<i.bulut@i...> wrote:
>this query is OK for one record, but does exsist any solution to
> update customers c
> set
> totalorders = (select sum(Orders.TotalOrders) from orders orders
> where orders.CustomerID = c.id)
> where c.id = :id
repeat query n time (n is a nuber of records in the orders table) in
one SQL statment.
Thanks
>trick.
>
> ----- Original Message -----
> From: "majstoru" <majstoru@y...>
> To: <firebird-support@yahoogroups.com>
> Sent: Tuesday, December 27, 2005 12:48 AM
> Subject: [firebird-support] Small Update SQL trick (problem)
>
>
> > Hi,
> >
> > I have a small problem, maybe is not a problem, but an expret
> > I'm using Firebird 2 and I have two tables fex: Customers,Orders! I
> > would like to write a SQL statment to update Customers (fieldorders,
> > TotalOrders) from table Orders.
> > Something like:
> > UPDATE Customers
> > SET TotalOrders = SUM(Orders.TotalOrders)
> > // begin of the problem
> > The continue of this SQL must update all customers form table
> > something like FOR DO (in delphi).StoredProcedure!
> > Important: I need this solution like SQL statment no
> >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > Thanks for ALL...
> >
> >
> >
> >
> >
> >
> >
> >item
> > Visit http://firebird.sourceforge.net and click the Resources
> > on the main (top) menu. Try Knowledgebase and FAQ links !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >
> > Also search the knowledgebases at http://www.ibphoenix.com
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> > __________ NOD32 1.1340 (20051226) Information __________
> >
> > This message was checked by NOD32 antivirus system.
> > http://www.eset.com
> >
> >
>