This should help you:

http://stackoverflow.com/questions/22108219/how-to-update-a-table-using-another-table-or-aggregation-results-from-subquery

On 9 Jun 2016 20:03, "Alberto Ferrari" <aferrari@starconnecting.com> wrote:
Hi Pierre, is not working....

"error, unexpected IDENT, expecting SET..."



2016-06-09 14:26 GMT-03:00 Pierre-Adrien Coustillas <pcoustillas@1g6.biz>:
Hi,

  Try it :

UPDATE 
MY_TABLE  a,
( SELECT 
(SUM( t.mins * t.acpm ) / t.rcpmax) AS calc1
(SUM( t.mins * t.acxh ) / t.acxmax) AS calc2
FROM MY_TABLE  t 
GROUP BY t.source, t.name_id
) q
SET
a.awc = q.calc1,
a.lcr = q.calc2
WHERE a.source = q.source 


Pierre


De: "Alberto Ferrari" <aferrari@starconnecting.com>
À: "Communication channel for MonetDB users" <users-list@monetdb.org>
Envoyé: Jeudi 9 Juin 2016 19:05:25
Objet: Update JOIN?

Is it possible to Update Join in Monet?
I need something like this... (just an example)

UPDATE 
MY_TABLE AS a,
( SELECT 
(SUM( t.mins * t.acpm ) / t.rcpmax) AS calc1
(SUM( t.mins * t.acxh ) / t.acxmax) AS calc2
FROM MY_TABLE AS t 
GROUP BY t.source, t.name_id
) AS q
SET
a.awc = q.calc1,
a.lcr = q.calc2
WHERE a.source = q.source 
AND a.name_id = q.name_id 

When I try to execute this type of query, I get this error...
syntax error, unexpected AS, expecting SET in: "update sb_rmsv.rmsv_nts_nt_sum_report as"

_______________________________________________
users-list mailing list
users-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/users-list