Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
特殊SQLite排序顺序Swift 3_Sqlite_Uitableview_Swift3 - Fatal编程技术网

特殊SQLite排序顺序Swift 3

特殊SQLite排序顺序Swift 3,sqlite,uitableview,swift3,Sqlite,Uitableview,Swift3,我想要一个普通名字的排序数组。它们在SQLite中可以通过 `...ORDER BY RL_Species.species ASC` 然而,并不是每个物种都有一个共同的名字,所以有许多记录“没有共同的名字”。我想对所有常用名称进行ASC排序,但将所有“无常用名称”列在已排序列表的底部 它在TableViewController中调用,基本代码为: override func tableView(_ tableView: UITableView, cellForRowAt indexPath:

我想要一个普通名字的排序数组。它们在SQLite中可以通过

`...ORDER BY RL_Species.species ASC`
然而,并不是每个物种都有一个共同的名字,所以有许多记录“没有共同的名字”。我想对所有常用名称进行ASC排序,但将所有“无常用名称”列在已排序列表的底部

它在TableViewController中调用,基本代码为:

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
    let cell: UITableViewCell       = tableView.dequeueReusableCell(withIdentifier: Resource.SpeciesCell)!

    let specieCommonName: UILabel   =         
            speciesCommonName.text   = self.species[(indexPath as NSIndexPath).row].commonName


    return cell
}

这可能吗?

请尝试以下查询:

SELECT * FROM `TABLENAME` ORDER BY case when RL_Species.species='no common name' then 1 else 0 end,RL_Species.species ASC

请尝试以下查询:

SELECT * FROM `TABLENAME` ORDER BY case when RL_Species.species='no common name' then 1 else 0 end,RL_Species.species ASC

放你查询?放你查询?不幸的是,这不起作用。仍然没有错误地排序,但没有将“No Common Name”移到末尾。我错过了在“No Common Name”中键入“n”的机会。将其更改为“否”,现在可以工作了。非常感谢。这是非常有用的。不幸的是,这不起作用。仍然没有错误地排序,但没有将“No Common Name”移到末尾。我错过了在“No Common Name”中键入“n”的机会。将其更改为“否”,现在可以工作了。非常感谢。这帮了大忙