falck3 Posted March 21, 2015 Report Posted March 21, 2015 (edited) Lietoju šo SELECT * FROM members ORDER BY `referrals` WHERE `id`>2114 Ir errors : #1064 - 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 'WHERE `id`>2114 LIMIT 0, 30' at line 3 Doma parādīt sarakstu ar MEMBERS kuru `referrals` kuru `id` ir lielāks kā 2114 bez ORDER BY `referrals` viss ir ok bet tā nesanāk ko daru nepareizi?? Paldies Edited March 21, 2015 by falck3 Quote
kristerskz Posted March 21, 2015 Report Posted March 21, 2015 (edited) WHERE jāliek pirms ORDER BY. Šādi: SELECT * FROM members WHERE `id`>2114 ORDER BY `referrals` Edited March 21, 2015 by kristerskz Quote
falck3 Posted March 21, 2015 Author Report Posted March 21, 2015 Nenotestēju, bet WHERE būtu jāliek pirms ORDER BY. Visticamāk, ka šādi strādā: SELECT * FROM members WHERE `id`>2114 ORDER BY `referrals` Pamēģināju arī tā! Jā nau errors bet nekārto pēc `referrals` Quote
jurchiks Posted March 21, 2015 Report Posted March 21, 2015 (edited) >ORDER BY `referrals` >nekārto pēc `referrals` Wut? Vai nu kaut kur citur kodā tiek pārkārtots, vai tomēr kārto. Edited March 21, 2015 by jurchiks Quote
falck3 Posted March 21, 2015 Author Report Posted March 21, 2015 kā lai order by referrals bet rādītu tam referrals tos id kas ir tie pēc 2114? Quote
jurchiks Posted March 21, 2015 Report Posted March 21, 2015 Kāpēc vispār tāds nesmuks nosacījums - ID pēc 2114? Quote
falck3 Posted March 22, 2015 Author Report Posted March 22, 2015 Kāpēc vispār tāds nesmuks nosacījums - ID pēc 2114? jo būs tāds kā pasākums kurā tiks skaitīti tikai id > ka 2114 Quote
qwerty Posted March 22, 2015 Report Posted March 22, 2015 Noteikti kārto, SQL ir pareizs. Pēc noklusējuma viņš kārto augošā secībā (ASC). Varbūt tu saki, ka "nekārto", jo tev vajag dilstošā? Ja tā, tad ir jāraksta ORDER BY `referrals` DESC Quote
falck3 Posted March 22, 2015 Author Report Posted March 22, 2015 (edited) Username Referrals Admin 2 f1stptcupdate 9 AIS01 1 elena075 12 InternsLink 1 viking88hp 7 kelly998888 99 Ir tā man vaig lai tabulā "Referrals" (tas cipars ir kopējais skaits) skaitu veidotu no useriem kuru id ir lielāks kā 2114 Edited March 22, 2015 by falck3 Quote
falck3 Posted March 22, 2015 Author Report Posted March 22, 2015 pieliec sortēšanas virzienu. Paskaidrosi sīkāk? Quote
qwerty Posted March 22, 2015 Report Posted March 22, 2015 Paskaidrosi sīkāk? Pēc noklusējuma viņš kārto augošā secībā (ASC). Varbūt tu saki, ka "nekārto", jo tev vajag dilstošā? Ja tā, tad ir jāraksta ORDER BY `referrals` DESC Quote
briedis Posted March 22, 2015 Report Posted March 22, 2015 Kāds ir kolonnas tips referālim? Minu, kas teksts, nevis integers :) Quote
falck3 Posted March 22, 2015 Author Report Posted March 22, 2015 Kāds ir kolonnas tips referālim? Minu, kas teksts, nevis integers :) ir int(11) tas slikti? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.