0

My data (tyreinfo) table is this:

width | ratio | rim
------+-------+----
35    | NONE  | 40
40    | NONE  | 90
22    | 22    | 70

when I tried mysql query

SELECT * from tyreinfo WHERE ratio=NONE

it gave me an error: Unknown column 'NONE' in 'where clause'. But this query works when I tried

SELECT * from tyreinfo WHERE ratio=22

I also tried:

SELECT * from tyreinfo WHERE ratio='NONE'

It gives me no results. What is the correct query?

Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
Alex
  • 11,551
  • 13
  • 30
  • 38
  • post the `show create table tyreinfo` output please – guido Oct 27 '14 at 01:06
  • What is the type of tyreinfo? Is it set as varchar or int? – The One and Only ChemistryBlob Oct 27 '14 at 01:06
  • @guido, it is: Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available. – Alex Oct 27 '14 at 01:08
  • @TheOneandOnlyChemistryBlob do you mean the type of ratio? it is text – Alex Oct 27 '14 at 01:09
  • @Alex that does not look like a mysql error; are you using a gui? – guido Oct 27 '14 at 01:10
  • @guido I am using phpmyadmin – Alex Oct 27 '14 at 01:12
  • SELECT * from tyreinfo WHERE ratio='NONE' is correct with a text column type and should give you the correct results. I suggest you create a simple sqlFiddle. – mseifert Oct 27 '14 at 01:14
  • @mseifert Thanks mseifert, it is the right one. The reason I did not get the result was because it includes an ENTER in my data field. I have got over 300 rows in my data table, do you know how I can trim all the data in the table? – Alex Oct 27 '14 at 01:47
  • This should do it: read [this post](http://stackoverflow.com/questions/11839060/find-and-replace-text-in-all-table-using-mysql-query) – mseifert Oct 27 '14 at 13:30

1 Answers1

0

to your last question:

UPDATE tyreinfo SET ratio='NONE' WHERE ratio like 'NONE%'

I guess it's what you mean - it will change ratio to 'NONE' in every row where ratio begins at 'NONE'.