ray Posted August 28, 2006 Report Share Posted August 28, 2006 (edited) mans ir sql vaicājums "SELECT * FROM tabula ORDER BY seciba asc" problēma ir tāda, ka man kārto ierakstus šādi: 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 20, 3, 4, 5, 6, 7, 8, 9. kā lai izdara, tā un kas vēl ir jāiekļauj scriptā, lai kārtotu ierakstus normāli? Edited August 28, 2006 by ray Link to comment Share on other sites More sharing options...
Grey_Wolf Posted August 28, 2006 Report Share Posted August 28, 2006 ray --> tev vinji glabaajas kaa CHAR (WarChar) !!! Un taa arii ir pareiza simbolu ateeloshana.... Glabaa vinjus kaa integer un probleema atkritiis... Link to comment Share on other sites More sharing options...
litt Posted August 28, 2006 Report Share Posted August 28, 2006 Ja galīgi negribās secību kā number taisīt, tad var šādi (neatceros no kuras MySQL versijas tas ir): select * from tabula order by lpad(lauks,10,'0') Link to comment Share on other sites More sharing options...
ray Posted August 28, 2006 Author Report Share Posted August 28, 2006 es nevaru taisīt, kā INTEGER lauku, jo tikpat labi man var sanākt vērtība, pieņemsim, ka 5.00/10.00 un to INTEGER neatbalstīs, tāpēc jābūt CHAR. Link to comment Share on other sites More sharing options...
Roze Posted August 28, 2006 Report Share Posted August 28, 2006 Vai arī var izmantot CAST() http://dev.mysql.com/doc/refman/4.1/en/cast-functions.html select * from tabula order by cast(lauks AS UNSIGNED) Link to comment Share on other sites More sharing options...
goldy Posted August 28, 2006 Report Share Posted August 28, 2006 (edited) man liekas, ka tev uz šejieni jādodas: http://dev.mysql.com/doc/refman/4.1/en/num...e-overview.html oi tas "5.00/10.00" bija domāts kā viens ieraksts? Edited August 28, 2006 by goldy Link to comment Share on other sites More sharing options...
Delfins Posted August 28, 2006 Report Share Posted August 28, 2006 5.00/10.00 un to INTEGER neatbalstīs lōģoski... tam domāts floats :) Link to comment Share on other sites More sharing options...
ray Posted August 28, 2006 Author Report Share Posted August 28, 2006 (edited) CAST () bija tieši tas, kas man bija vajadzīgs, PALDIES!!! Edited August 28, 2006 by ray Link to comment Share on other sites More sharing options...
Recommended Posts