mmk Posted June 11, 2004 Report Share Posted June 11, 2004 nu MySQL vai citu DB guru, pasakiet... ir tabula: id:animal 1:lacis 2:kakis 3:suns 4:suns 5:lacis 6:lacis No vo tagad gribas, lai saskaita cik ir animalu pa grupaam un sarindo peec skaita, tjipa: animal:count(animal) lacis:3 suns:2 kakis1 Tad kad liek group by, tad vinsh sarindo peec zveera nosaukuma... a kaa uzlikt lai sarindo peec skaita?? Link to comment Share on other sites More sharing options...
hu_ha Posted June 11, 2004 Report Share Posted June 11, 2004 SELECT count(animal) as sk FROM `tabula` group by animal order by sk desc Link to comment Share on other sites More sharing options...
DimanC Posted June 12, 2004 Report Share Posted June 12, 2004 biku palabošu hu_ha: SELECT animal, count(animal) as sk FROM `tabula` group by animal order by sk desc nu tas tā... ja grib, lai rādītu arī animal. var jau būt, ka šīs diskusijas aizsācējam tas var noderēt. ;) (rezultāts būs 2 kolonnas - 1. animal. 2. viņu skaits.) Link to comment Share on other sites More sharing options...
hu_ha Posted June 12, 2004 Report Share Posted June 12, 2004 nu tas itkaa pashsaprotami, bet, protams, var pienjemt, ka ne visiem :) Link to comment Share on other sites More sharing options...
mmk Posted June 14, 2004 Author Report Share Posted June 14, 2004 hmmz, select as nebija sanaacis piekopt! laikam jau derees! fiel thanks! Link to comment Share on other sites More sharing options...
Recommended Posts