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.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 1- Rownum doesn't buy you anything, other then ending the inner select after retreiving one row.There are many ways in javascript to handle drag and drop. If you’d like to use something else there are three pieces of key information that need to be sent to the server: With this approach the server will do a total of three queries for every change to the display order no matter how many items are in the list.

now when ever if i add a new entry ...i want to sort it and i want to assign the sorted it for that.2- What would almost make more sense is moving the 'rownum=1' condition to the outer SQL statement (update), but there again you are selectively picking the first row, when you don't know the order that multiple rows may be returned.FYI - rownum is not a row id and can not be counted on to identify a specific row, other then the position that the row is returned with the return set.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.

Search for database updating sort order:

database updating sort order-35database updating sort order-62database updating sort order-60

In many of our applications we support dragging and dropping datasets to change the order.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “database updating sort order”