Database updating sort order

Laravel is a web application framework with expressive, elegant syntax.

We believe development must be an enjoyable, creative experience to be truly fulfilling.

Could I do something like this: UPDATE MY_TABLE SET col1 = :new Value WHERE col2 = (SELECT MIN(col2) FROM MY_TABLE WHERE ROWNUM = 1 AND col1 = 0); If this is OK, I was wondering what are the performance implications of moving the "WHERE" clause to the outer update statement (index is on col2 as well), i.e.: UPDATE MY_TABLE SET col1 = :new Value WHERE col1 = 0 AND col2 = (SELECT MIN(col2) FROM MY_TABLE WHERE ROWNUM = 1); Thanks Sandra It appears that what you want to do is to update the row having the lowest value for col2 where col1=0.

database updating sort order-21

If they aren't really duplicate rows, then use the other columns that aren't identical to correctly sort out the ONE row you really want.

(then get a proper primary key created on that table ASAP) But if you really must do something like this, what's wrong with a little PL/SQL block?

How can I achieve the above Thanks Sandra I am trying to do the following: EXEC SQL UPDATE MY TABLE SET COL1 = :new Value WHERE COL1 = 0 AND ROWNUM = 1 ORDER BY COL2; (index on COL1, COL2) Pro*C does not process the "ORDER BY" statement.

How can I achieve the above Thanks Sandra "order by" is not valid in an update command.

Is there any way I can achieve what I need to do in SQL?

function call_campaigns_cookie() function mobile Sidebar Fix() var hide Mobile Header Container = true; $(document).ready(function(){ /*!

I would like to enable users of my application to define a number of (say) email addresses.

Then I would like to give them the ability to rearrange these addresses, so the primary address is on top, secondary next, etc.

I need to re-sort the way the strings are displayed in the client so that they are alphabetical ( The order can be changed in the client and that is the official method but it's such a clunky method that it would literally take days and thousands of mouse-clicks to do this. To do this in SQL I need to sort the whole table on column E and then sort column F ascending and then UPDATE the whole table.

So far as I can see MS SQL does not allow an UPDATE including an ORDER BY and I'm struggling to find a coherent way to do this.

Furthermore, if you don't specify an 'order by clause' the rows can be in any order.


  1. I mentioned my predicament to Jessica, and she excitedly revealed that her good friend had just moved to the city I was visiting.

  2. A 2017-03-22: Wenn ich das recht verstehe, wäre ...

  3. This is why you should gently guide your partner toward working with a therapist.

Comments are closed.