0

A Rails application I'm currently working on uses the character Æ in some database values. How can I create a SELECT statement that will treat Æ and AE as equal?

e.g.: SELECT * FROM users WHERE lower(name) = 'aether' should return a row where the value in the name column is Aether OR Æther.

Jamie
  • 1,607
  • 3
  • 17
  • 25
  • What have you tried? Also, selects merely return whatever you tell it to. Select doesn't care what is in your database. Please elaborate what you mean when you say "will treat Æ the same as AE" – Jenn Jun 26 '14 at 21:22
  • I edited the question in an attempt to clarify. I'm not quite sure how to word it properly. – Jamie Jun 26 '14 at 21:52
  • Not sure if it will work exactly, but this is full of interesting things to try: http://stackoverflow.com/questions/2302813/normalizing-accented-characters-in-mysql-queries – Unixmonkey Jun 26 '14 at 21:59
  • If I get no other answers this might work. Thanks. – Jamie Jun 26 '14 at 22:07

1 Answers1

0

After another lengthy Google session, I finally stumbled upon the answer.

SELECT * FROM users WHERE lower(replace(name,'Æ','Ae')) = 'aether'

...appears to give the correct result. You can now cease your downvoting.

Jamie
  • 1,607
  • 3
  • 17
  • 25