FOUND_ROWS

Stai visualizzando una vecchia versione di questo article. Visualizza la versione più recente.

Sintassi

FOUND_ROWS()

Spiegazione

Le istruzioni SELECT possono includere la clausola LIMIT, la quale restringe il numero di righe che il server restituisce al client. In certi casi però è desiderabile sapere quante righe sarebbero state restituite senza LIMIT, ma senza eseguire di nuovo l'istruzione. Per ottenere questo numero, si può includere l'opzione SQL_CALC_FOUND_ROWS nell'istruzione SELECTe invocare successivamente FOUND_ROWS():

Esempi

MariaDB [(none)]> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name 
    -> WHERE id > 100 LIMIT 10;
MariaDB [(none)]> SELECT FOUND_ROWS();

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.