dbx Posted October 21, 2008 Share Posted October 21, 2008 I have a select statement like the following: select * from db where tm>='0'; Possible values of tm in the table are: N/A, 0, 1, 2, 3, 4, 5, 6 When the query is run, it displays all the rows, including those that have tm set to 'N/A'. Could someone explain to me why that is, and hopefully give me a way around it, so that those that are 'N/A' are not displayed. I am able to change the value from N/A if needed, but the other numbers need to remain the same. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/129371-solved-select-problem-na-is-greater-than-or-equal-to-0-zero/ Share on other sites More sharing options...
JasonLewis Posted October 21, 2008 Share Posted October 21, 2008 SELECT * FROM db WHERE tm>=0 && tm<>'N/A' Not sure if its <> or != in MySQL. Don't think it'll matter. Or instead of N/A, you could set it to -1 which would represent N/A. Quote Link to comment https://forums.phpfreaks.com/topic/129371-solved-select-problem-na-is-greater-than-or-equal-to-0-zero/#findComment-670685 Share on other sites More sharing options...
hellonoko Posted October 21, 2008 Share Posted October 21, 2008 Are N/A vlues null? empty? What about something like. SELECT * FROM db WHERE tm >= '0' AND tm != NULL or when you display the values of tm if ( array[$value != empty) echo or whatever Quote Link to comment https://forums.phpfreaks.com/topic/129371-solved-select-problem-na-is-greater-than-or-equal-to-0-zero/#findComment-670686 Share on other sites More sharing options...
dbx Posted October 22, 2008 Author Share Posted October 22, 2008 With some changes in a few places, setting it to -1 instead of "N/A" should do the trick, I think. Thanks for your replies. Quote Link to comment https://forums.phpfreaks.com/topic/129371-solved-select-problem-na-is-greater-than-or-equal-to-0-zero/#findComment-671573 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.