sandis_m Posted November 29, 2011 Report Share Posted November 29, 2011 Kā vislabāk un ērtak ieglabāt iekš GROUP_CONCAT 2 vērtības (ja tas ir iespejas. patreiz sanāk tikai ar vienu) (Un kā vispār to izarīt) <?php $sql = mysql_query("SELECT galv.*, undegalv.*, COUNT(undergalv.id) as `skaits`, GROUP_CONCAT(undergalv.sdescription SEPARATOR '|') AS viskas FROM `galvenais` galv, `undergalvenais` subtas WHERE galv.id=undergalv.tid GROUP BY galv.id ORDER BY galv.id DESC, undergalv.id DESC"); while($data = mysql_fetch_array($sql)){ ?> Galvenais: <?php echo $data["name"];?>:<br/> Zem galvena: <br/> <?php if(!empty($data["viskas"])){ $viskas= explode('|', $data['viskas']); foreach($viskas as $apraksts){ echo $apraksts; // izvada aprakstu. viss ok. bet vajag, lai panem velvienu undergalvenais lauku - status. } } } ?> Quote Link to comment Share on other sites More sharing options...
Kavacky Posted November 29, 2011 Report Share Posted November 29, 2011 (edited) <pre class="programlisting"> GROUP_CONCAT([DISTINCT] expr [,expr ...] [ORDER BY {unsigned_integer | col_name | expr} [ASC | DESC] [,col_name ...]] [sEPARATOR str_val])</pre> Edited November 29, 2011 by Kavacky 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.