Jump to content
  • Advertisement
Sign in to follow this  
Alpha_ProgDes

[web] Get MIN(_field_) when _field_ is nvarchar

This topic is 3168 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Basically in my table I have a record that look like this:
File A    000    A
File A    001    B
File A    002    C
Where A, B, C are the revisions. What's the best way to get earliest Rev (in this case: A)?

Share this post


Link to post
Share on other sites
Advertisement
The easiest way that springs to mind is just SELECT * FROM _table_ ORDER BY _field_ LIMIT 1. That said, MySQL is content to allow MIN(_field_) as it is.

One simple way to force a text column to be treated as numeric is to multiply it by one (MIN(1*_field_), for example).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!