Hennikenno Posted December 30, 2008 Report Share Posted December 30, 2008 (edited) Sveiki. Te atkal es! Šoreiz atkal problēma ar datu sakārtošanu. Respektīvi man ir sekojoš kverijs: $res = mysql_query("SELECT id, username, class, donor, warned FROM users WHERE last_access >= 900 ORDER BY class DESC") or print(mysql_error()); Viņš paņem no datubāzes visus lietotājus, kuri ir bijuši aktīvi pēdējās 15 min un sakārto pēc klases (dilstošā secībā). Bet es gribu panākt tā, lai katru klasi viņš sakārto pēc lietotājvārda un augošā secībā. Mēģināju šādi, bet nesanāca: $res = mysql_query("SELECT id, username, class, donor, warned FROM users WHERE last_access >= 900 ORDER BY class DESC AND username ASC") or print(mysql_error()); izmantojot šādu kodu man izmeta šādu erroru: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND username ASC' at line 1 Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in D:\web\apache\htdocs\index.php on line 70 Kur ir problēma? EDIT: Viskārtībā problēma atrisināta! ;) Edited December 30, 2008 by Hennikenno Link to comment Share on other sites More sharing options...
marcis Posted December 30, 2008 Report Share Posted December 30, 2008 SELECT id, username, class, donor, warned FROM users WHERE last_access >= 900 ORDER BY class DESC, username ASC http://dev.mysql.com/doc/refman/5.0/en/ord...timization.html Link to comment Share on other sites More sharing options...
Recommended Posts