I have an old sqlite database that I am no longer going to be using but I want to transfer all of my data to my new mySQL database. I have everyone imported and it all looks good but the problem is when I order my one of my columns which contains float values things go weird. Any data that is newly uploaded regardless of the size of the float gets placed first when I order by that column in ascending order. For instance, if I ALREADY had these floats: 100.2, 101.2, 150.5
before in the sqlite database and then after moving them to mySQL I append to that list something like 100.5
when I order them using SELECT * FROM TABLE ORDER BY float ASC
instead of getting 100.2 100.5 101.2 150.5
I get 100.5 100.2 101.2 150.5
even if I then appended something like 300.5 it would just insert the 300.5 in between 100.5 and 100.2. Any ideas why? The collation is same between the two but it just won't order them correctly, any thoughts as to why?
toxicandy
2
Junior Poster
Recommended Answers
Jump to Postfloat is a reserved keyword, so try:
SELECT * FROM `TABLE` ORDER BY `float` ASC
But I'm thinking that this isn't the name of your field?
Jump to PostHi, I understand the data is float but I'm not sure about the column type, is this:
decimal
,float
ordouble
?
Jump to PostStrange. Works for me. I created your table, imported a slice of the data and inserted a record. I ran your select query, but it all looks ok to me:
Jump to PostSame for me, I ran:
SELECT * FROM `playertimes` WHERE `runtime` BETWEEN 100 AND 200 ORDER BY `runtime` ASC LIMIT 20
And returns in perfect order.
All 14 Replies
diafol
toxicandy
2
Junior Poster
cereal
1,524
Nearly a Senior Poster
Featured Poster
toxicandy
2
Junior Poster
diafol
toxicandy
2
Junior Poster
diafol
cereal
1,524
Nearly a Senior Poster
Featured Poster
toxicandy
2
Junior Poster
diafol
toxicandy
2
Junior Poster
diafol
toxicandy
2
Junior Poster
cereal
1,524
Nearly a Senior Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.