Artenis Posted January 28, 2010 Report Share Posted January 28, 2010 (edited) Sveiki! Ideja sekojoša. Piemēram ir 1000 lietotāji un ir top 20+1(es). Es parādu to top 20, bet kā 21 gribu ielikt arī savu vietu topā. Īsti nevaru iedomāties. Ko darīt, ja es piemēram esmu 800 vietā no visiem, bet kā to mani - vienu no visiem lietotajiem parādīt, lai nebūtu drausmīgas slodzes un bremzēšana? Īsumā: top20 + mana pozīcija no visiem. (1,2,3,4....20,800) Ceru, ka sanāca paskaidrot kaut cik prātīgi, lai doma būtu. Paldies. Edited January 28, 2010 by Artenis Quote Link to comment Share on other sites More sharing options...
2easy Posted January 28, 2010 Report Share Posted January 28, 2010 (edited) SELECT * FROM Users ORDER BY Score DESC LIMIT 20 UNION SELECT * FROM Users WHERE Id = myid ja vietas vēl nav iedalītas (nav piešķirts konkrēts numurs/vieta), tad šeit ir ideja, kā to tehniski var izdarīt http://php.lv/f/topic/13621-izvadam-kura-vieta-ir-pec-kaut-ka/page__view__findpost__p__117130 Edited January 28, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
briedis Posted January 28, 2010 Report Share Posted January 28, 2010 (edited) SELECT * FROM Users ORDER BY Score DESC LIMIT 20 UNION SELECT * FROM Users WHERE Id = myid SELECT * FROM Users WHERE Id <> myid ORDER BY Score DESC LIMIT 20 UNION SELECT * FROM Users WHERE Id = myid Edited January 28, 2010 by briedis Quote Link to comment Share on other sites More sharing options...
2easy Posted January 28, 2010 Report Share Posted January 28, 2010 tās jau ir teh nianses. var jau last row neņemt vērā, ja vieta ir divdesmitniekā Quote Link to comment Share on other sites More sharing options...
Artenis Posted January 28, 2010 Author Report Share Posted January 28, 2010 Paldies! Paskatīšos. Vietas piešķirts nav doma tāda, ka tas tops ir dinamisks un mainās principā katru sekundi. Quote Link to comment Share on other sites More sharing options...
2easy Posted January 28, 2010 Report Share Posted January 28, 2010 tad jau gan vajag kkādu counteri, lai aizskaitītu līdz 800, ja jau tas 800 nav pašos row datos Quote Link to comment Share on other sites More sharing options...
Artenis Posted January 31, 2010 Author Report Share Posted January 31, 2010 tad jau gan vajag kkādu counteri, lai aizskaitītu līdz 800, ja jau tas 800 nav pašos row datos Jā tādēļ nevaru izdomāt pareizi kā tas būtu pareizi, jo nav tas pašos row datos. Quote Link to comment Share on other sites More sharing options...
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.