Vamsi
Vamsi

Reputation: 873

Getting different count values if i run a query with more than maximum value of column value

Today I've encountered a new issue in MySQL.

When I've executed the following query

select `column` from table where `column` between '1' and '30000'

I've got three results

234
123
111

and when I've executed same query with different value

select `column` from table where `column` between '1' and '9000'

I've got six results

111
123
343
234
765
568

What could be the issue?

FYI : Datatype of the column is varchar.

Upvotes: 0

Views: 48

Answers (2)

ikku
ikku

Reputation: 405

The problem here is that you try to select on a text based field in a numeric way. If you would change your field to a integer field you'll get the expected results.

Upvotes: 1

Mahmoud Gamal
Mahmoud Gamal

Reputation: 79969

It seems that, the issue is that the column column is not of data type numeric, it is varchar or string.

Upvotes: 1

Related Questions