mysql - Where in/Where, Less than and Order by. Simplest query not working -
on table:
id | name | type | rank ------------------------------------------------ 1 | firm1 | french companies | 45 2 | firm2 | french companies | 53 3 | firm3 | french companies | 78 4 | firm4 | french companies | 12
id = int(11), rank = rank, name = varchar(255), type = varchar(255)
i use these 2 simplest queries , not return result
query1:
select * firms type in ('french companies') , rank <= 100000 order rank desc
query2:
select * firms type = 'french companies' , rank <= 100000 order rank desc
update
select * firms type in ('french companies')
and select * firms type = 'french companies'
both work fine. problem seems in rest of part...
update
for 'french companies' rank null in real data. problem solved... commented helped me debug
if have leading or trailing whitespace in type
column explain current query failing. if so, trimming whitespace should query work:
select * firms trim(type) = 'french companies' , rank <= 100000 order rank desc
i have verified in demo below if rank
column text, comparison still work numerically appears mysql implicitly cast data.
Comments
Post a Comment