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. 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. 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 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. 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
Archived
This topic is now archived and is closed to further replies.