我需要对两个字符串进行排序,并考虑>和<符号.因此,例如,排序可能看起来像
<20
<40
<100
0.1
10
1,000,000.75
>100
>1,000
Run Code Online (Sandbox Code Playgroud)
所以基本上所有带<的字符串首先是正常排序,然后是带有>符号的所有数字.我也想要尊重所显示的确切顺序(例如>从100到1000之前出现> 100时从高到高排序)
这是我的代码,没有符号(排序表中的所有行):
if ($this.hasClass('sort-mixed')) {
sort_func = sort_mixed;
}
$rows.sort(sort_func);
function sort_mixed(a, b) {
var val_a = $(a).children().eq(column_index).text();
var val_b = $(b).children().eq(column_index).text();
val_a = Number(val_a.toString().replace(/,/g, ""));
val_b = Number(val_b.toString().replace(/,/g, ""));
if(val_a > val_b) {
return 1 * sort_direction;
}
if(val_a < val_b) {
return -1 * sort_direction;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud) 编辑#2:我现在尝试了两个MariaDB数据库,一个MySQL和一个Percona,只有MariaDB实例被锁定.
我在远程服务器上有一个MariadB(版本5.5.56)的锁定等待超时问题,我没有在本地MySQL(版本5.5.57)实例上.我知道这是因为我导出了远程数据库,然后在本地导入它,问题就消失了.
可以肯定的是,查询非常大.让我们说它是一个非常大的选择查询,有大量的左连接和内连接(见下文).
我已经尝试将远程my.cnf文件设置为几乎与我的本地服务器相同,但是在SHOW VARIABLES;那里运行有一个很大的区别,我真的不想逐行完成差异(如下所示).
我只是想知道是否有人知道从哪里开始?我已经尝试了一些像这里发布的那些没有任何运气的建议.
如果有人认为最简单的事情就是尝试升级到MariadB 10.x,那么我就是这样做的游戏.
谢谢.
编辑:附加Diff和SQL查询
SQL查询
SELECT commerce_product.product_id AS product_id, commerce_product.sku AS commerce_product_sku, taxonomy_term_data_field_data_field_sample_name.name AS taxonomy_term_data_field_data_field_sample_name_name, taxonomy_term_data_field_data_field_sample_name.vid AS taxonomy_term_data_field_data_field_sample_name_vid, taxonomy_term_data_field_data_field_sample_name.tid AS taxonomy_term_data_field_data_field_sample_name_tid, taxonomy_term_data_field_data_field_sample_name__taxonomy_vocabulary.machine_name AS taxonomy_term_data_field_data_field_sample_name__taxonomy_vo, taxonomy_term_data_field_data_field_sample_origin.name AS taxonomy_term_data_field_data_field_sample_origin_name, taxonomy_term_data_field_data_field_sample_origin.vid AS taxonomy_term_data_field_data_field_sample_origin_vid, taxonomy_term_data_field_data_field_sample_origin.tid AS taxonomy_term_data_field_data_field_sample_origin_tid, taxonomy_term_data_field_data_field_sample_origin__taxonomy_vocabulary.machine_name AS taxonomy_term_data_field_data_field_sample_origin__taxonomy_, taxonomy_term_data_field_data_field_sample_matrix.name AS taxonomy_term_data_field_data_field_sample_matrix_name, taxonomy_term_data_field_data_field_sample_matrix.vid AS taxonomy_term_data_field_data_field_sample_matrix_vid, taxonomy_term_data_field_data_field_sample_matrix.tid AS taxonomy_term_data_field_data_field_sample_matrix_tid, taxonomy_term_data_field_data_field_sample_matrix__taxonomy_vocabulary.machine_name AS taxonomy_term_data_field_data_field_sample_matrix__taxonomy_, taxonomy_term_data_field_data_field_sample_volume.name AS taxonomy_term_data_field_data_field_sample_volume_name, taxonomy_term_data_field_data_field_sample_volume.vid AS taxonomy_term_data_field_data_field_sample_volume_vid, taxonomy_term_data_field_data_field_sample_volume.tid AS taxonomy_term_data_field_data_field_sample_volume_tid, taxonomy_term_data_field_data_field_sample_volume__taxonomy_vocabulary.machine_name AS taxonomy_term_data_field_data_field_sample_volume__taxonomy_, 'commerce_product' AS field_data_title_field_commerce_product_entity_type, 'commerce_product' AS field_data_commerce_stock_commerce_product_entity_type, 'commerce_product' AS field_data_field_minimum_order_commerce_product_entity_type, 'commerce_product' …Run Code Online (Sandbox Code Playgroud)