Free private night chat - Updating multiple rows
It's not perfect, just the first thing that came to mind. UPDATE foo SET x = 10 WHERE partition='key' AND bar=1 IF (SELECT y FROM foo WHERE partition='key' AND baz = 2) = 3 Pro: Good match with semantics of what CAS actually does under the hood Fairly natural for SQL users Con: Need to invent syntax for multiple columns ( IF (SELECT y, z ...) = (3, 4) ) Risks confusing people who wonder why we don't support subqueries elsewhere Not necessarily obvious that subquery is restricted to the same partition Maybe some new kind of BATCH, CAS BATCH?I don't see how this solves the problem of "I want to CAS row X based on the value of row Y." Your example looks more like 3 separate operations each of which has CAS-in-same-row.
Now, for a little untested PHP code similar to something I’ve been working on: $query_part) // Build the WHERE part.
Since we keyed our update_values off the database keys, this is pretty easy $where = " WHERE `id`='" .
I’ve had to figure this out on my own twice now, so I guess it’s time to document it.
It is possible, and fairly easy, to update multiple rows of a My SQL table at the same time, with different values for each row.
I don't see how this solves the problem of "I want to CAS row X based on the value of row Y." Your example looks more like 3 separate operations each of which has CAS-in-same-row. But to match thrift api you are going to need both the ability to update several rows in a single cas operation and the ability to refer to other rows within the same partition in conditions.
I'm also quite reluctant in adding some sub-query syntax "just for this", mainly for the cons expresses above, that is 1) the fact that it confuses quite a bit the "we don't do sub-query" message and 2) it doesn't make it very clear what the restrictions on that sub-query are.I want to UPDATE a field of table with the results of another query, (sub query), but my sub quesry contains a Group By and so returns multipel rows.UPDATE TABLE_ONE SET TOTAL_SALES =(SUBQUERY) The Subquery: Select COUNT(*) from TABLE_TWO where TRANSACTION_TYPE="SALE" GROUP BY PERSON_ID QUERIES together UPDATE TABLE_ONE SET TOTAL_SALES=(SELECT Count(*) FROM TABLE_TWO GROUP BY PERSON_ID) This Subquery return multiple rows and hence teh ORA-01427 error.Is there a way in Excel to split a large file into a series of smaller ones, based on the contents of a single column? You might choose to just plow through it sequesntially, but I always like having options.eg: I have a file of sales data for all sales reps. For posterity, here's yet another macro to tackle this problem.Which is not to say that I have a much better idea.Tags: Adult Dating, affair dating, sex dating