mors Posted February 26, 2004 Report Share Posted February 26, 2004 vai ir iespeejams ieksh viena querija uztaisit ko shadu: ir tabula, kura ir 2 lauki - id un strings. stringi var atkartoties. vajag izvadit sarakstu, kura tiek paraditi 'nevienadie' stringi, piem. - ja kopa ir 21 ieraksts, no kuriem ir 5 rindinas, kuru stringi ir 'a', 6 - 'b' un 10 'c', tad vajag izvadit pirmo c un paradit ierakstu skaitu, kuru stringi satur 'c' (saja gadijuma - 10), otro b (6) un treso a (5). Link to comment Share on other sites More sharing options...
Aleksejs Posted February 26, 2004 Report Share Posted February 26, 2004 varbūt tā: select count(id), strings from tabula group by strings Link to comment Share on other sites More sharing options...
mors Posted February 27, 2004 Author Report Share Posted February 27, 2004 nez vai .. Link to comment Share on other sites More sharing options...
sviesc Posted March 1, 2004 Report Share Posted March 1, 2004 apmēram šitā SELECT COUNT(DISTINCT tabulas lauks) FROM tabula Link to comment Share on other sites More sharing options...
Venom Posted March 1, 2004 Report Share Posted March 1, 2004 laikam kaut kā tā: SELECT DISTINCT `string`,COUNT(`string`) as `skaits` FROM table GROUP BY `string` ORDER BY `skaits` DESC incanti, kā izskatīsies SQL tulkojums iekš tās lv: IZVĒLĒTIES NEATKARTOJOŠOS `string`,SKAITU(`string`) kā `skaits` NO tabulas SAGRUPĒT VIENĀDUS `string` IZKĀRTOT PĒC `skaits` DILSTOŠI Link to comment Share on other sites More sharing options...
Recommended Posts