How do I get the largest value with the longest length in mysql in order by desc?

Asked

Viewed 132 times

0

I have a sequence of values, for example:

w1-16
w2-16
w3-16
w4-16
w5-16
w6-16
w7-16
w8-16
w9-16
w10-16
w11-16 

So on and so forth.

I made a query that takes the correct sequence as above. Example:

select week from tabela where group by week order by length(week), week;

I tried to put the desc in the most end comes all in disarray, I would like to take the highest value with the highest length as in the example of the sequence above the value w11-16 the last value is not fixed it can change in case of insertion in the table someone knows a way to do this?

  • Take off the length(week)

  • Who takes precedence? The greater value or greater length?

  • that take the two values, I actually want to take the last inserted value

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.