Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 2 of 2 total |
what am i doing wrong |
Tue, Oct 8 2013 8:55 PM | Permanent Link |
Aaron Taylor | Im trying to total the client invoices and post it into the client table
This works and returns the total SELECT SUM(Total) FROM Invoices WHERE Client_ID = 123 this does not work UPDATE Clients SET Total_Sales = (SELECT SUM(Total) FROM Invoices WHERE Client_ID = 123) WHERE ID = 123 |
Wed, Oct 9 2013 3:27 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Aaron
>this does not work > >UPDATE Clients SET Total_Sales = (SELECT SUM(Total) FROM Invoices WHERE Client_ID = 123) >WHERE ID = 123 DBISAM just doesn't support that syntax. Its a long time since I used DBISAM so I may be wrong, or there may be a better way but I'd suggest a script along the lines of select 'total_sales' as id, sum(total) as totals where client_id = 123 into memory\fred from invoices; update clients set total_sales = totals from clients left outer join memory\fred as fred on id = _total_sales; drop table memory\fred; Roy Lambert [Team Elevate] |
This web page was last updated on Sunday, May 5, 2024 at 07:30 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |