0

Hi,
can anybody, please help me out.

[B]select * from log where id <='%07%' [/B]

Am facing the syntax error, what is the actual query?

my id look like this:
1.mtg10kl
2.mtg07kl
3.mtg06kl
4.mtg09kl

I need the output this:
1.mtg07kl
2.mtg06kl

please help me out .thanks in advance

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by jacksantho
0

first of all, the percentage sign should have gone with the 'Like' wildcard. from your id's, you wont even get an answer if you had no errors because the comparison operator would search for exactly whats on the right side of the query but using the 'LIKE' keyword would produce A better result

0

There isn't a way to do what you are asking. LIKE won't work since you are looking for <=.
What you can do based on your sample is substring like this:

select * from log where convert(int,substring(log,4,2)) <= 7

You also can try your luck without the conversion to int.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.