Page 1 of 1

select query issue

Posted: Fri Dec 08, 2006 4:51 am
by itsmani1
need help in query

Code: Select all

select name form test where name = [first letter is a]
for example if name is :

Calgary, AB
Opelika, AL
Miami, FL

then it should show

Opelika, AL and Calgary, AB as both start with A

any help.

thanks

Posted: Fri Dec 08, 2006 4:58 am
by volka
select name from test where name < 'b'

Re: select query issue

Posted: Fri Dec 08, 2006 6:29 am
by timvw
itsmani1 wrote:need help in query

Code: Select all

select name form test where name = [first letter is a]
for example if name is :

Calgary, AB
Opelika, AL
Miami, FL

then it should show

Opelika, AL and Calgary, AB as both start with A
They don't start with A. They start with O and C.

The problem is that you've stuffed two values in the same column (city and state). Assuming that you're lucky and there are not city names with a comma in there name you could select WHERE name LIKE '%, A%'.