2f262ebebd76067ea983cfeb7454ed626a450c61
angie
  Fri Jan 6 15:45:54 2017 -0800
In mysql 5.7 with the default configuration, it is now an error if a SELECT list using DISTINCT does not include all ORDER BY fields.  The solution is to add the ORDER BY fields to the end of the SELECT list if they're not already included.  The extra columns returned by the query are ignored.  refs #18626, #18597

diff --git src/hg/lib/web.c src/hg/lib/web.c
index 7d6abe6..6c29c02 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -547,31 +547,36 @@
 }
 
 void printCladeListHtml(char *genome, char *onChangeText)
 /* Make an HTML select input listing the clades. */
 {
 char **row = NULL;
 char *clades[128];
 char *labels[128];
 char *defaultClade = hClade(genome);
 char *defaultLabel = NULL;
 int numClades = 0;
 
 struct sqlConnection *conn = hConnectCentral();  // after hClade since it access hgcentral too
 // get only the clades that have actual active genomes
 char query[4096];
-safef(query, sizeof query, NOSQLINJ "SELECT DISTINCT(c.name), c.label FROM %s c, %s g, %s d WHERE c.name=g.clade AND d.organism=g.genome AND d.active=1 ORDER BY c.priority", cladeTable(),genomeCladeTable(), dbDbTable());
+sqlSafef(query, sizeof query, "SELECT DISTINCT(c.name), c.label "
+         // mysql 5.7: SELECT list w/DISTINCT must include all fields in ORDER BY list (#18626)
+         ", c.priority "
+         "FROM %s c, %s g, %s d WHERE c.name=g.clade AND d.organism=g.genome AND d.active=1 "
+         "ORDER BY c.priority",
+         cladeTable(), genomeCladeTable(), dbDbTable());
 struct sqlResult *sr = sqlGetResult(conn, query);
 while ((row = sqlNextRow(sr)) != NULL)
     {
     clades[numClades] = cloneString(row[0]);
     labels[numClades] = cloneString(row[1]);
     if (sameWord(defaultClade, clades[numClades]))
 	defaultLabel = clades[numClades];
     numClades++;
     if (numClades >= ArraySize(clades))
         internalErr();
     }
 sqlFreeResult(&sr);
 hDisconnectCentral(&conn);
 
 struct slPair *names = trackHubGetCladeLabels();