MySQL Forums
Forum List  »  Newbie

Can I make SELECT DISTINCT case insensitive?
Posted by: Daniel Carrera
Date: April 05, 2009 11:57AM

Hello. I have something of the form:

INSERT INTO t1 (foo) SELECT DISTINCT foo FROM t2

Field foo is VARCHAR and in t1 it is a primary key. Here is the problem: When inserting into t1, MySQL treats '7a' and '7A' as the same value, so it is case insensitive. But the SELECT DISTINCT statement returns 7a and 7A as distinct values, so it is case sensitive.

Is there a way to make SELECT DISTINCT be case-insensitive so that it returns either 7a or 7A but not both? Alternatively, I think I could get away with making the key in table t1 case-sensitive, though that would not be my first choice.

Thanks for the help.

Options: ReplyQuote


Subject
Written By
Posted
Can I make SELECT DISTINCT case insensitive?
April 05, 2009 11:57AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.