Originariamente inviata da
optime
Ancora, basterebbe leggere il messaggio di errore. O metti orientamento nella group by, o lo togli dalla order by
Anche qui mi da l'errore anche se non c'è l'orientamento, credo che l'errore sia dovuto al fatto che la select ha due campi di ricerca mentre solo uno dei due ricompare nell'orientamento.
Non so proprio come risolvere.
codice:
$mysqli = new mysqli("$dbhost", "$dbuser", "$dbpass");$mysqli->select_db("$dbname");
$result = mysqli_query ($mysqli,"SELECT anno, nome_file FROM fotografie_rally GROUP BY anno LIMIT $limite OFFSET $offset");
$num = mysqli_num_rows ($result);
if ($result === false) {
echo "ERRORE: " . mysqli_error($mysqli);
}
$end=1;
$i=1; // contatore
while($row = mysqli_fetch_assoc($result)) {
$file = $row['nome_file'];
$anno = $row['anno'];
$title = $row['anno'];
$subtitle = "ANNO $anno";
if ($anno == 2004) {
$title = "PRIMA DEL 2005";
$subtitle = "PRIMA DEL 2005";
}
L'errore è:
ERRORE: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'gianluca50928.fotografie_rally.nome_file' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by