sql >> Database >  >> RDS >> Mysql

MySql combineert LIMIT en ORDER BY

Op verzoek van OP.

LIMIT gaat als laatste. Dat was een slecht antwoord https://stackoverflow.com/a/26041483/1415724 .

Raadpleeg zelf de handleiding op SELECT http://dev.mysql. com/doc/refman/5.7/en/select.html

SELECT
    [ALL | DISTINCT | DISTINCTROW ]
      [HIGH_PRIORITY]
      [MAX_STATEMENT_TIME = N]
      [STRAIGHT_JOIN]
      [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
      [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
    select_expr [, select_expr ...]
    [FROM table_references
      [PARTITION partition_list]
    [WHERE where_condition]
    [GROUP BY {col_name | expr | position}
      [ASC | DESC], ... [WITH ROLLUP]]
    [HAVING where_condition]
    [ORDER BY {col_name | expr | position}
      [ASC | DESC], ...]
    [LIMIT {[offset,] row_count | row_count OFFSET offset}]
    [PROCEDURE procedure_name(argument_list)]
    [INTO OUTFILE 'file_name'
        [CHARACTER SET charset_name]
        export_options
      | INTO DUMPFILE 'file_name'
      | INTO var_name [, var_name]]
    [FOR UPDATE | LOCK IN SHARE MODE]]



  1. MariaDB JSON_VALID() uitgelegd

  2. Wat is de beste manier om dubbele waarden uit de MySQL-tabel te verwijderen?

  3. Toon alle MySQL-tabelgegevens in html-tabel

  4. Kan de FULLTEXT-index niet vinden die overeenkomt met de kolomlijst (indexen zijn ingesteld)