Kaynağa Gözat

sort news the other way

Eren Yilmaz 6 yıl önce
ebeveyn
işleme
07118ff66a
1 değiştirilmiş dosya ile 6 ekleme ve 4 silme
  1. 6 4
      model.py

+ 6 - 4
model.py

@@ -435,10 +435,12 @@ def news():
     connect()
 
     cursor.execute('''
-        SELECT *
-        FROM news
-        ORDER BY dt DESC
-        LIMIT 20
+        SELECT * FROM
+            (SELECT *
+            FROM news
+            ORDER BY dt DESC
+            LIMIT 20) n
+        ORDER BY dt ASC
         ''')
 
     return cursor.fetchall()