ViszinisA Posted November 20, 2006 Report Share Posted November 20, 2006 labriit ir tabula ieksh mysql lauki: id, id_who, name, text, date id - vnk id ierakstam (unique, autoinc) id_who - kam tas pieder (tipa komentaars kurai bildei, vai sadaljai) name - ... text - ... date - ... kaa var SELECT id_who.... bet taa lai id_who neatkārtotos (tipa unique laikam)? varbuut kaut kas saads eksistee??? SELECT UNIQUE (id_who) FROM `blah bla` Link to comment Share on other sites More sharing options...
andrisp Posted November 20, 2006 Report Share Posted November 20, 2006 (edited) Nav īsti skaidrs, ko tu vēlies. Atlasīt konkrēties ierakstus konkrētam lietotājam ? Vai arī atlasīt sarakstu ar lietotājiem, kas vispār kautko darījuši ? 1) SELECT * FROM `table` WHERE `id_who` = 'bla'; 2) SELECT id_who, count(id_who) as cnt FROM `table` GROUP BY id_who; Edited November 20, 2006 by andrisp Link to comment Share on other sites More sharing options...
Vebers Posted November 20, 2006 Report Share Posted November 20, 2006 SELECT DISTINCT id_who FROM tabula Link to comment Share on other sites More sharing options...
ViszinisA Posted November 20, 2006 Author Report Share Posted November 20, 2006 varbuut man der tas otrais grrr paskaidroshu ar alus pielietojumu id id_kadu_alu_dzer name 1 | pilzenes gaishais | artis 2 | pilzenes gaishais | mudaks 3 | pilzenes gaishais | gafgaf 4 | cesu tumsais | tu 5 | krutka | kakis 6 | pilzenes gaishais | suns es gribu lai no shaadaas tabulas man atdod 3 rindas pilzenes gaisais cesu tumsais krutka saprati ideju? Link to comment Share on other sites More sharing options...
andrisp Posted November 20, 2006 Report Share Posted November 20, 2006 Varbūt tev der ? Vienkārši pārbaudi ! ;) Link to comment Share on other sites More sharing options...
Recommended Posts