Permalink
Browse files

Now artists/albums are properly sorted and grouped

1 parent 75f30fd commit b89ab1a9108e49d63ecc88abf10a0bc2515e9c57 @treus treus committed Dec 10, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/db.c
View
@@ -1168,16 +1168,16 @@ db_build_query_browse(struct query_params *qp, char *field, char **q)
if (idx && qp->filter)
query = sqlite3_mprintf("SELECT DISTINCT f.%s, f.%s FROM files f WHERE f.data_kind = 0 AND f.disabled = 0 AND f.%s != ''"
- " AND %s %s;", field, field, field, qp->filter, idx);
+ " AND %s ORDER BY f.%s %s;", field, field, field, qp->filter, field, idx);
else if (idx)
query = sqlite3_mprintf("SELECT DISTINCT f.%s, f.%s FROM files f WHERE f.data_kind = 0 AND f.disabled = 0 AND f.%s != ''"
- " %s;", field, field, field, idx);
+ " ORDER BY f.%s %s;", field, field, field, field, idx);
else if (qp->filter)
query = sqlite3_mprintf("SELECT DISTINCT f.%s, f.%s FROM files f WHERE f.data_kind = 0 AND f.disabled = 0 AND f.%s != ''"
- " AND %s;", field, field, field, qp->filter);
+ " AND %s ORDER BY f.%s;", field, field, field, qp->filter, field);
else
- query = sqlite3_mprintf("SELECT DISTINCT f.%s, f.%s FROM files f WHERE f.data_kind = 0 AND f.disabled = 0 AND f.%s != ''",
- field, field, field);
+ query = sqlite3_mprintf("SELECT DISTINCT f.%s, f.%s FROM files f WHERE f.data_kind = 0 AND f.disabled = 0 AND f.%s != '' ORDER BY f.%s",
+ field, field, field, field);
if (!query)
{

0 comments on commit b89ab1a

Please sign in to comment.