Sabtu, 01 Juli 2017

SQL Select Statement Limit Desc Order

Permasalahan ini timbul ketika kita ingin melakukan query terhadap sejumlah data dan mengurutkan kembali secara descending.
Perhatikan tabel berikut

http://www.softscients.web.id/2017/07/sql-select-statement-limit-desc-order.html
Apa yang terjadi jika kita menggunakan sql code berikut?
[A] select * from tabel order by id desc limit 6
[B] select * from tabel order by id asc limit 6
[C] select * from (select * from tabel order by id desc limit 6) tmp order by id asc

Referensi:
https://stackoverflow.com/questions/14165231/sql-select-statement-limit-desc-order
Posting Komentar