Dooling Posted July 26, 2007 Report Share Posted July 26, 2007 Ir tabula: ID | laiks | tips ---------------------- 1 | 12.07| 1 2 | 14.07| 2 3 | 12.07| 1 4 | 18.07| 2 ... Vai var ar vaicājuma palīdzību apvienot divus ierakstu vienā, piemēram, "12.07|14.07", "12.07|18.07"? Jau stundu domāju kā to realizēt, vai kāds var ideju kādu pasviest? Link to comment Share on other sites More sharing options...
cucumber Posted July 26, 2007 Report Share Posted July 26, 2007 (edited) Ja var Concat funkcija palasi ieksh mysql.org, sorry tas laiakm soreizs nederes. Pamegini apstradam masivu, ja tu gribi apvienot pa pariem tas rindas. Edited July 26, 2007 by cucumber Link to comment Share on other sites More sharing options...
Dooling Posted July 26, 2007 Author Report Share Posted July 26, 2007 Jā, ideja ir apvienot pa pāriem tās rindas. Link to comment Share on other sites More sharing options...
cucumber Posted July 26, 2007 Report Share Posted July 26, 2007 (edited) Izvelc vajadzigas rindas no mysql, tad resource izbrauc ar foreach un (ja iet id pec kartas) par moduli skaties vai ir para vai nepara un apvieno rindas, ieliekot jauna masiva. Vai izvelc sakuma ar vienu tipu, tad ar otru, un tikai tad veic apvienoshanu. Ar mysql laikam ar var bija tur tada, lieta ka mainigie. Edited July 26, 2007 by cucumber Link to comment Share on other sites More sharing options...
Aleksandrs Posted July 26, 2007 Report Share Posted July 26, 2007 Ja ID ir viens pēc otra nepārtrauktā secībā un tipi ir konkrēti nodefinēti, tad der šāds vaicājums: SELECT a.laiks,b.laiks FROM `TABULA` a JOIN `TABULA` b ON a.tips=1 AND b.tips=2 AND a.id+1=b.id Link to comment Share on other sites More sharing options...
Dooling Posted July 26, 2007 Author Report Share Posted July 26, 2007 Paldies, Aleksandr! Kā reiz man šis risinājums arī der ;) Link to comment Share on other sites More sharing options...
PheliX Posted July 27, 2007 Report Share Posted July 27, 2007 Vēl jau ir arī http://dev.mysql.com/doc/refman/5.0/en/gro...on_group-concat ... Link to comment Share on other sites More sharing options...
Recommended Posts