Volevo sapere se questa query è giusta e se può essere scritta in altri modi. Grazie
codice:SELECT * FROM messaggi WHERE(numero=1 and rif in (SELECT max(id) as cont,rif FROM messaggi WHERE(rif>='.($pag-20).' and rif<='.$pag.') group by rif ORDER by cont DESC'))

Rispondi quotando