Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 12 su 12

Hybrid View

  1. #1
    Se devi per forza usare il "limit" nella seconda query, dovrai farne un'altra che conti il totale (quindi senza limit) e da quel risultato sottrarre 1..

    Query1:
    select ... from ... where ... limt 0,1

    Query di conteggio
    select count id_data as Totale from ... where ....

    Prendo il valore e tolgo 1
    $limite = $record->Totale - 1;

    Query di recupero dei record "restanti"
    select .. from .. where ... limt 1, $limite

    Brutto, perchè fai una query aggiuntiva, ma efficace e, se gli indici son ben fatti, non appesantisce il db server

  2. #2
    non c'è bisogno di extra query, lo dice anche il manuale di mysql

    https://dev.mysql.com/doc/refman/8.0/en/select.html

    To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:
    codice:
    SELECT*FROM tbl LIMIT95,18446744073709551615;
    sapevatelo


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.