Mega Code Archive

 
Categories / MySQL / Select Clause
 

Convert the output column and sort that-but doing so affects the displayed values, possibly in an undesirable

way mysql> mysql> CREATE TABLE textblob_val     -> (     ->  tstr    TEXT,   # not case sensitive     ->  bstr    BLOB    # case sensitive     -> ); Query OK, 0 rows affected (0.00 sec) mysql> mysql> mysql> INSERT INTO textblob_val (tstr,bstr) VALUES('aaa','aaa'),     ->                                            ('AAA','AAA'),     ->                                            ('bbb','bbb'),     ->                                            ('BBB','BBB'); Query OK, 4 rows affected (0.00 sec) Records: 4  Duplicates: 0  Warnings: 0 mysql> mysql> SELECT * FROM textblob_val; +------+------+ | tstr | bstr | +------+------+ | aaa  | aaa  | | AAA  | AAA  | | bbb  | bbb  | | BBB  | BBB  | +------+------+ 4 rows in set (0.00 sec) mysql> mysql> mysql> SELECT UPPER(bstr) FROM textblob_val ORDER BY 1; +-------------+ | UPPER(bstr) | +-------------+ | AAA         | | BBB         | | aaa         | | bbb         | +-------------+ 4 rows in set (0.00 sec) mysql> drop table textblob_val; Query OK, 0 rows affected (0.00 sec)