Delfins Posted October 11, 2005 Report Share Posted October 11, 2005 Klez joprojām nav sapratis problēmas būtību. nav tur nekāda limita, ir groupings Link to comment Share on other sites More sharing options...
Klez Posted October 11, 2005 Report Share Posted October 11, 2005 (edited) CREATE TABLE tezz ( id INT (3) UNSIGNED DEFAULT '0' AUTO_INCREMENT, user VARCHAR (20) DEFAULT '0', pass VARCHAR (3) DEFAULT '0', PRIMARY KEY(id) ); INSERT INTO tezz (id, user, pass) VALUES (NULL, 'user1', 'xxx'); INSERT INTO tezz (id, user, pass) VALUES (NULL, 'user2', 'xxx'); INSERT INTO tezz (id, user, pass) VALUES (NULL, 'user3', 'xxx'); INSERT INTO tezz (id, user, pass) VALUES (NULL, 'user1', 'xxx'); INSERT INTO tezz (id, user, pass) VALUES (NULL, 'user1', 'xxx'); SELECT `user`, COUNT( * ) AS cnt FROM tezz GROUP BY `user` HAVING cnt > 0 rezlultaats: | user | cnt | -------------- user1 | 3 user2 | 1 user3 | 1 ja pareizi sapratu tavu jaut, tad vaidzeetu taa kaa dereet. man sanaaca tas ko tew tur vaidzeeja. Edited October 11, 2005 by Klez Link to comment Share on other sites More sharing options...
Delfins Posted October 11, 2005 Report Share Posted October 11, 2005 (edited) a ID, un DATE ? :) +--------+-----+----+------+ | userid | cnt | id | try | +--------+-----+----+------+ | user1 | 3 | 1 | 1 | | user2 | 1 | 2 | 1 | | user3 | 1 | 3 | 1 | +--------+-----+----+------+ 3 rows in set (0.00 sec) (nepareiz rezultāts pēc tava SQL) PS: tipiskā non-sub-query problēma Edited October 11, 2005 by Delfins Link to comment Share on other sites More sharing options...
Klez Posted October 11, 2005 Report Share Posted October 11, 2005 (edited) kaads veel ID un DATE ??? vinjam tak tos nevaidzeeja. tad tak lai pareizi uzraksta ko grib panaakt ... vai arr ko izselekteet veel vieniigi manaa query jaapielasa klaat paroles. jo tas try jau vinjam ir skaits, cik useri ir ar vienaadu nick Edited October 11, 2005 by Klez Link to comment Share on other sites More sharing options...
druidos Posted October 11, 2005 Author Report Share Posted October 11, 2005 šitais der tiaki ar PHP pre-pārsēšanu :rolleyes: mysql> select userid, max(concat(try,',',id)) as maxtry from userlog group by userid; +--------+-------------------------+ | userid | max(concat(try,',',id)) | +--------+-------------------------+ | user1 | 3,5 | | user2 | 1,2 | | user3 | 1,3 | +--------+-------------------------+ 3 rows in set (0.01 sec) while ( $row .. ) { $a = explode( ',', $row->maxtry ); $row->try = $a[0]; $row->id = $a[1]; } diezgan netriviāli, bet ja nedrīkst qub-query... 24450[/snapback] Kurā vietā man vajadzētu izprasīt password lauku? Ja es to prasu: select userid, [b]password[/b], max(concat(try,',',id)) as maxtry from userlog group by userid , tad man izdod pirmā ieraksta paroli. Bet ja prasu iekš concat - viss normāli, BET, jautājums, vai tas neradīs palielinoties datu apjomam? Link to comment Share on other sites More sharing options...
druidos Posted October 11, 2005 Author Report Share Posted October 11, 2005 Labi, tauta, nemokiet sevi. Lai arī gribējās daudzmaz skaisti to lietu sataisīt, nāksies vien taisīt neskaisti - pielikšu slēdzi un taisīšu papildUPDATE pie datu ievades. :(( Link to comment Share on other sites More sharing options...
Klez Posted October 11, 2005 Report Share Posted October 11, 2005 uzraksti ko tu iisti veeleejies no taas tabulas izdabuut ? lietotaajus ar vienaadu niku ? vai ko citu ? Link to comment Share on other sites More sharing options...
druidos Posted October 11, 2005 Author Report Share Posted October 11, 2005 uzraksti ko tu iisti veeleejies no taas tabulas izdabuut ? lietotaajus ar vienaadu niku ? vai ko citu ? 24460[/snapback] Sk. pirmo postu. Paroles, protams, dažādas. Paldies visiem! Link to comment Share on other sites More sharing options...
Delfins Posted October 11, 2005 Report Share Posted October 11, 2005 Bet ja prasu iekš concat - viss normāli, BET, jautājums, vai tas neradīs palielinoties datu apjomam? 24457[/snapback] tik cik salikt kopā stringu un salīdzināt bišku garāku penteri. nedomāju ka ievērojami lēnāk, nekā taisīsi ar sub-query vai kā citādi. Es jau teicu iepriekš, tas TRY lauks nav vajadzīgs... pilnīgi pietiek pamat-tabulā saglabāt pēdējo lietoto paroli (pie nepareizās), vai referenci uz `vēstures` ierakstu Link to comment Share on other sites More sharing options...
Recommended Posts