-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TiDB group_concat bug: order by desc substatement don't work #9523
Comments
Hi, @vkingnew |
duplicate with #6838 |
ok,it can implements by substatement like this ::
|
It's not safe. |
yes,the performance is a questions when have to much data. |
Of course, we'll support it. |
TiDB Version:
mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v2.1.5-1-g0bd6b1b
Git Commit Hash: 0bd6b1b
Git Branch: release-2.1
UTC Build Time: 2019-02-28 08:17:03
GoVersion: go version go1.11.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
1 row in set (0.00 sec)
create table t(id bigint not null auto_increment primary key,country varchar(20),city_id int,city_name varchar(20));
insert into t(province,city_id,city_name)values('china',0,'wuhan'),('china',1,'xiangyang'),('china',2,'yicang'),('china',3,'shenzhen'),('china',4,'beijing');
statement1:rigth.
mysql> select country,group_concat(city_id) IDS,group_concat(city_name) NAMES from t group by country\G
*************************** 1. row ***************************
country: china
IDS: 0,1,2,3,4
NAMES: wuhan,xiangyang,yicang,shenzhen,beijing
1 row in set (0.02 sec)
statement 2:error
mysql> select country,group_concat(city_id order by city_id) IDS,group_concat(city_name order by city_id desc) NAMES from t group by country\G
*************************** 1. row ***************************
country: china
IDS: 0,1,2,3,4
NAMES: wuhan,xiangyang,yicang,shenzhen,beijing
1 row in set (0.02 sec)
statement 3:error
mysql> select country,group_concat(city_id order by city_id desc)IDS,group_concat(city_name order by city_id desc) NAMES from t group by country\G
*************************** 1. row ***************************
country: china
IDS: 0,1,2,3,4
NAMES: wuhan,xiangyang,yicang,shenzhen,beijing
1 row in set (1.27 sec)
MySQL 5.7.24 run statement2 and statement 3:
mysql> select version();
+------------+
| version() |
+------------+
| 5.7.24-log |
+------------+
1 row in set (0.00 sec)
mysql> select country,group_concat(city_id order by city_id) IDS,group_concat(city_name order by city_id desc) NAMES from t group by country\G
*************************** 1. row ***************************
country: china
IDS: 0,1,2,3,4
NAMES: beijing,shenzhen,yicang,xiangyang,wuhan
1 row in set (0.00 sec)
The text was updated successfully, but these errors were encountered: