Hi All,
I am using SQL Server 2014.
I have a column named 'Range' in TableA
Data type of 'Range' column is 'nvarchar(25)'
Values of 'Range' column are:
Fruit Apple 1
Fruit Apple 100-4A
Fruit Apple 999-55-16A
Fruit Apple 2
Fruit Apple 2200-4A
Fruit Apple 2898-55-16A
Fruit Apple 3
Fruit Apple 3000-125-15
Fruit Apple 3008-75-12A
On my aspx web page, I have a dropdown menu like this:
range 0-1000
range 1001-2000
range 2001-3000
If I select range 0-1000, I want to display these values:
Fruit Apple 1
Fruit Apple 2
Fruit Apple 3
Fruit Apple 100-4A
Fruit Apple 999-55-16A
If I select range 1001-2000, I want to display these values:
Fruit Apple 2200-4A
Fruit Apple 2898-55-16A
If I select range 2001-3000, I want to display these values:
Fruit Apple 3000-125-15
Fruit Apple 3008-75-12A
This is my query for range 0-1000 (this query doesn't work correctly).
select * from TableA
WHERE Range between 'Fruit Apple 0001' and 'Fruit Apple 2000'
I think this is not correct because the data type of 'range' column is 'nvarchar' not 'int' but
I do not know how to fix it.
I appreciate your help in advance.