Page 1 of 1

Wildcards with leading characters help?

Posted: Wed Aug 13, 2008 7:30 pm
by recci
I have been asked to create 4 wildcard selects one of which must have a leading character.

I take it all a wildcard select is, is something like this:


SELECT * FROM example WHERE age LIKE '2%' ;

The one thing I'm not sure about is the leading character thing?

Anybody got any example of a basic select wildcard query with leading character in it?

cheers

Re: Wildcards with leading characters help?

Posted: Thu Aug 14, 2008 12:38 pm
by califdon
recci wrote:I have been asked to create 4 wildcard selects one of which must have a leading character.

I take it all a wildcard select is, is something like this:

SELECT * FROM example WHERE age LIKE '2%' ;

The one thing I'm not sure about is the leading character thing?

Anybody got any example of a basic select wildcard query with leading character in it?

cheers
You've already got it, right there, unless they're asking for something different--oh, assuming that the field is Text. If `age` is a numeric field (and you should ordinarily never store someone's AGE in a table, it will be meaningless next year! always store the date of birth, or at least year of birth), you would need to use a numeric function, such as WHERE age BETWEEN 20 and 29.