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"
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"
Hi Pierre, is not working....
"error, unexpected IDENT, expecting SET..."
2016-06-09 14:26 GMT-03:00 Pierre-Adrien Coustillas
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"
*À: *"Communication channel for MonetDB users" *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"
This should help you:
http://stackoverflow.com/questions/22108219/how-to-update-a-table-using-anot...
On 9 Jun 2016 20:03, "Alberto Ferrari"
Hi Pierre, is not working....
"error, unexpected IDENT, expecting SET..."
2016-06-09 14:26 GMT-03:00 Pierre-Adrien Coustillas
: 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"
*À: *"Communication channel for MonetDB users" *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
The link did not help me, any other ideas please?
2016-06-09 16:23 GMT-03:00 Roberto Cornacchia
This should help you:
http://stackoverflow.com/questions/22108219/how-to-update-a-table-using-anot...
On 9 Jun 2016 20:03, "Alberto Ferrari"
wrote: Hi Pierre, is not working....
"error, unexpected IDENT, expecting SET..."
2016-06-09 14:26 GMT-03:00 Pierre-Adrien Coustillas
: 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"
À: "Communication channel for MonetDB users" 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
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
Why not? this works (syntactically --- I have not data) for me: sql>create table my_table (awc int, mins int, acpm int, rcpmax int, source int, name_id int, acxh int, acxmax int, lcr int); operation successful (25.731ms) sql>UPDATE MY_TABLE set awc = ( SELECT t.mins * t.acpm / t.rcpmax FROM MY_TABLE AS t WHERE MY_TABLE.source = t.source AND MY_TABLE.name_id = t.name_id ), lcr = ( SELECT t.mins * t.acxh / t.acxmax FROM MY_TABLE AS t WHERE MY_TABLE.source = t.source AND MY_TABLE.name_id = t.name_id ) where exists ( SELECT * FROM MY_TABLE AS t WHERE MY_TABLE.source = t.source AND MY_TABLE.name_id = t.name_id ); 0 affected rows (14.845ms) Best, Stefan ----- On Jun 14, 2016, at 1:34 PM, Alberto Ferrari aferrari@starconnecting.com wrote:
The link did not help me, any other ideas please?
2016-06-09 16:23 GMT-03:00 Roberto Cornacchia
: This should help you:
http://stackoverflow.com/questions/22108219/how-to-update-a-table-using-anot...
On 9 Jun 2016 20:03, "Alberto Ferrari"
wrote: Hi Pierre, is not working....
"error, unexpected IDENT, expecting SET..."
2016-06-09 14:26 GMT-03:00 Pierre-Adrien Coustillas
: 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"
À: "Communication channel for MonetDB users" 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
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
-- | Stefan.Manegold@CWI.nl | DB Architectures (DA) | | www.CWI.nl/~manegold/ | Science Park 123 (L321) | | +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
participants (4)
-
Alberto Ferrari
-
Pierre-Adrien Coustillas
-
Roberto Cornacchia
-
Stefan Manegold