ratcateme Posted February 3, 2008 Share Posted February 3, 2008 i have a table with data from my apache access log in it i am trying to use a where clause to select based on how big the size is i have this query SELECT * FROM `access` WHERE `size` > '500' ORDER BY `ID` ASC LIMIT 0 , 100; it gives 5 results all above 500 there should be 11 results i then ran this query: SELECT * FROM `access` WHERE `size` > '1000' ORDER BY `ID` ASC LIMIT 0 , 100; and got all results i should have only got 7 results i am totally stumped both query's are behaving differently when they are almost the same Scott. Quote Link to comment https://forums.phpfreaks.com/topic/89153-solved-mysql-giving-funny-results/ Share on other sites More sharing options...
p2grace Posted February 3, 2008 Share Posted February 3, 2008 You can remove the ASC, mysql will assume that by default. What happens when you put that query straight into phpmyadmin, does it still show incorrect number of results? Quote Link to comment https://forums.phpfreaks.com/topic/89153-solved-mysql-giving-funny-results/#findComment-456553 Share on other sites More sharing options...
ratcateme Posted February 3, 2008 Author Share Posted February 3, 2008 i removed ASC but nothing pma gives the wrong results to Scott. Quote Link to comment https://forums.phpfreaks.com/topic/89153-solved-mysql-giving-funny-results/#findComment-456557 Share on other sites More sharing options...
AndyB Posted February 3, 2008 Share Posted February 3, 2008 pma gives the wrong results to How do you know the result is wrong? Or do you mean it doesn't match your expectations? Quote Link to comment https://forums.phpfreaks.com/topic/89153-solved-mysql-giving-funny-results/#findComment-456560 Share on other sites More sharing options...
ratcateme Posted February 3, 2008 Author Share Posted February 3, 2008 it doesn't match my expectations but i don't no why because if i look at all the results with no where clause there are many results that should be included in th first query and a hole lot that are smaller than 1000 in the second query i am wondering if > is supported in a where clause dose anyone no anything about that Scott. Quote Link to comment https://forums.phpfreaks.com/topic/89153-solved-mysql-giving-funny-results/#findComment-456563 Share on other sites More sharing options...
sasa Posted February 3, 2008 Share Posted February 3, 2008 try SELECT * FROM `access` WHERE `size`+ 0 > 500 ORDER BY `ID` ASC LIMIT 0 , 100; Quote Link to comment https://forums.phpfreaks.com/topic/89153-solved-mysql-giving-funny-results/#findComment-456564 Share on other sites More sharing options...
ratcateme Posted February 3, 2008 Author Share Posted February 3, 2008 thanks sasa it works with that Scott. Quote Link to comment https://forums.phpfreaks.com/topic/89153-solved-mysql-giving-funny-results/#findComment-456567 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.