Jump to content
  • Advertisement
Sign in to follow this  
Alpha_ProgDes

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

This topic is 3349 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!