dreamwest Posted June 20, 2009 Share Posted June 20, 2009 Ive hit a block with this...I need to subtract 2 columns within a select then see if its less than 30 Heres what ive got mysql_query( "SELECT * FROM table WHERE rate !=0 and com_num !=0 and ((rate - com_num) < 30 )" ) Quote Link to comment https://forums.phpfreaks.com/topic/162990-select-2-columns/ Share on other sites More sharing options...
Ken2k7 Posted June 20, 2009 Share Posted June 20, 2009 So what's the problem? Your topic title is a bit misleading. I don't understand. Quote Link to comment https://forums.phpfreaks.com/topic/162990-select-2-columns/#findComment-860032 Share on other sites More sharing options...
dreamwest Posted June 20, 2009 Author Share Posted June 20, 2009 I want to subtract rate and com_num (within the query) then only select rows with a value less than 30 Is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/162990-select-2-columns/#findComment-860070 Share on other sites More sharing options...
Ken2k7 Posted June 20, 2009 Share Posted June 20, 2009 Yeah. Your query looks fine to me. What field type is rate and com_num? They should be ints. Quote Link to comment https://forums.phpfreaks.com/topic/162990-select-2-columns/#findComment-860231 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.