mysql方法来源于:http://www.cnblogs.com/jjcc/p/5896588.html ###在网上看到一篇,非常赞的方法### 比如说要获取班级的前3名,mysql就可以用GROUP_CONCAT + GROUP BY + substring_index实现. 考试表 DROP TABLE IF EXISTS `test`;CREATE TABLE `test` (`id` int(11) DEFAULT NULL,`name` varchar(20) DEFAULT N
SUBSTRING_INDEX(str,delim,count) Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, ev
SUBSTRING_INDEX(str,delim,count) Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative,
函数: 1.从左开始截取字符串 left(str, length) 说明:left(被截取字段,截取长度) 例:select left(content,200) as abstract from my_content_t 2.从右开始截取字符串 right(str, length) 说明:right(被截取字段,截取长度) 例:select right(content,200) as abstract from my_content_t 3.截取字符串 substring(str, pos) s
1. 代码 SELECT a.id, a.activity_name, ( CASE WHEN a.activity_end_time > now() THEN '参与中' ELSE ( CASE WHEN ( a.activity_doubt <> '*' AND a.activity_doubt < c.doubt ) OR ( a.activity_praise <> '*' AND a.activity_praise > c.praise * 100 )
函数: 1.从左开始截取字符串 left(str, length) 说明:left(被截取字段,截取长度) 例:select left(content,200) as abstract from my_content_t 2.从右开始截取字符串 right(str, length) 说明:right(被截取字段,截取长度) 例:select right(content,200) as abstract from my_content_t 3.截取字符串 substring(str, pos) s