SQL:可选地将多列分组

时间:2018-09-14 14:01:39

标签: mysql sql

我需要在下表中使用group by

id     ripped_file_name plate_length plate_width job_type_billing
665677 A                        23.5        26.0             1329
665678 A                        26.0        23.5             1329
665679 C                        26.0        23.5             1329
665680 D                        26.0        23.5             1329
665681 A                        26.0        23.5             1329
665682 A                        33.2        23.5             1329

Group by ripped_file_name,plate_width,plate_length

我要添加案例where plate_width的地方,plate_length可以互换

预期结果

id     ripped_file_name plate_length plate_width job_type_billing
665681 A                        23.5        26.0             1329
665679 C                        26.0        23.5             1329
665680 D                        26.0        23.5             1329
665682 A                        33.2        23.5             1329

因此在第一行,第二行和第五行中进行分组。

0 个答案:

没有答案