mattm1712 Posted September 20, 2012 Share Posted September 20, 2012 how can i do this? mysql_query("SELECT * FROM prices WHERE price='NUMERIC' ") i know NUMERIC wont work but im not sure how to do it cheers matt Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2012 Share Posted September 20, 2012 What are you trying to do? What is the data type of the field? Quote Link to comment Share on other sites More sharing options...
mattm1712 Posted September 20, 2012 Author Share Posted September 20, 2012 i have values like 12.2 14.5 - 1.2 0.3 - - 12.0 i want to remove all the '-''s Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2012 Share Posted September 20, 2012 You want to remove the entire row, or change the - to something? Once you figure out how you want to handle those rows, you'll want to change the column to be a decimal type. Quote Link to comment Share on other sites More sharing options...
mattm1712 Posted September 20, 2012 Author Share Posted September 20, 2012 i want to ignore them from my query Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 20, 2012 Share Posted September 20, 2012 You need to fix the data, so in the long term you have good data to work with. However, you can do != '-' for a quick fix. Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 20, 2012 Share Posted September 20, 2012 Yes, I am 100% in agreement with jesirose - your database schema is flawed. You should use a numeric type field to store the data. not sure what your intention of '-' is for. Do you interpret that as a 0.00 price or perhaps it means No Price? If you mean for that to be no price then you should change the field to a numeric type and allow nulls. Then set those fields to NULL. You're creating more problems for yourself later by doing what you are currently doing. Quote Link to comment 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.