General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>Dear Sir,
>
>Table1 has sno field varchar(70) and has this data
>
>
>1
>14
>1401
>1401001
>4
>41
>4101
>4101001
>4101002
>4101003
>4101020
>4101021
>4101022
>4102
>4102001
>4102002
>4102003
>4102020
>4102021
>45
>4501
>4501001
>4501002
>4501020
>4501021
>
>
>Now I want to get these codes only
>4101
>4101021
>4101022
>4102
>4102021
>
>Explanation:
>code between 4101020 and 4101050 alongiwth root code 4101
>code between 4102020 and 4102050 alongiwth root code 4102
>Do not want get any code that is greater that 4102099
>
>what query should I use?
select * from Table1 where between (val(left(field,4)), 4101, 4102) into cursor t_results
or
select * from Table1 where left(field,4) IN ("4101", "4102") into cursor t_results
should work for the example data, further filter for val(field)< 4102100 (or val(right(field,3))< 100) if question was imprecise) can be added
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only