Klez Posted March 22, 2005 Report Share Posted March 22, 2005 lieta taada. tabula, kuraa ir dati. id | nick | bilde | datums | koments 1 |janis|a.jpeg| 23.02 | superbilde 2 |janis|e.jpeg| 23.02 | superbilde 3 |janis|v.jpeg| 23.02 | superbilde 4 |edijs|c.jpeg| 23.02 | superbilde 4 |edijs|d.jpeg| 23.02 | superbilde 4 |edijs|f.jpeg| 23.02 | superbilde 4 |juris|d.jpeg| 23.02 | superbilde man no tabulas vajag katra nika vienu bildi un veel laukus datums un koments ar kaadaam SQL fcijaam to var izdariit distinct var njemt peec viena ... MySQL = 4.0.23 Link to comment Share on other sites More sharing options...
Lynx Posted March 23, 2005 Report Share Posted March 23, 2005 (edited) Hmm cik man sķiet tikai ar mysql to nevar dabūt gatavu - no vienas tabulas ailes izvilkt vienu ierakstu un no pārējām visus. Pats reiz meiģināju kautko tādu dabūt gatavu. Testejot izmeiģināju vairākus variantus gan ar DISTINCT, GROUP BY, pēc tam JOINOT datus etc. Nekā Edited March 23, 2005 by Lynx Link to comment Share on other sites More sharing options...
bubu Posted March 23, 2005 Report Share Posted March 23, 2005 Ko nozīmē vienu bildi? Vienalga jebkuru? Un kurus datus no datums/koments vajag, tikai tos, kas atbilst tai vienai bildei, kuru izvēlās, vai kā? Link to comment Share on other sites More sharing options...
Klez Posted March 23, 2005 Author Report Share Posted March 23, 2005 vaig dabuut no tabulas visus unikaalos nickus. $all = mysql_query("SELECT DISTINCT nick FROM tabula"); while ($one = mysql_fetch_row){ echo $one[0]."<br>"; echo '<img src="'.$one[].'">';//sheit vaig dabuut bildes vaardu *** } *** bet ar distinct nevar divus laikus. negribas tur arii veel vienu query likt... Link to comment Share on other sites More sharing options...
alins Posted March 23, 2005 Report Share Posted March 23, 2005 (edited) $all = mysql_query("SELECT DISTINCT(nick), bilde FROM tabula GROUP BY nick"); while ($one = mysql_fetch_row($all)){ echo $one[0]."<br>"; echo '<img src="'.$one[1].'">';//sheit vaig dabuut bildes vaardu *** } itkaa ir, ja tu domaa taa Edited March 23, 2005 by alins Link to comment Share on other sites More sharing options...
Klez Posted March 23, 2005 Author Report Share Posted March 23, 2005 paldies... probleemu atrisinaaju :) Link to comment Share on other sites More sharing options...
Recommended Posts