| Username |
Post |
| Santosh Neupane |
Posted
on 10-Feb-02 09:13 PM
How do I select the zipcodes which has '2' on the fourth position?
|
| SMSainju |
Posted
on 10-Feb-02 09:22 PM
Santosh, Use "Like" SMSainju
|
| SP |
Posted
on 10-Feb-02 09:52 PM
use like '___2%'
|
| NT |
Posted
on 11-Feb-02 01:13 AM
Just use this if using ASP : <%=mid("12345",4,1)%> The response you get is "4". Just take the variable(Zipcode) instead of "12345" and you're on your way. Late !
|
| NT |
Posted
on 11-Feb-02 01:16 AM
Sorry, I guess SAN does not want the Script dilimiters on the MSGBrd. Hence, the code not showing up in my previous message. Here you go :: mid("12345",4,1) Response you get is "4". Late !
|
| Santosh Neupane |
Posted
on 11-Feb-02 10:50 AM
Thanks Guys,
|
| san |
Posted
on 11-Feb-02 10:56 AM
Hey Santosh, If you're using Access then use select * from yourtable where zipcodefield Like '???2*'
|
| Santosh Neupane |
Posted
on 11-Feb-02 12:29 PM
thank you san dai, i did the zipcode = '___2%' and it works, but san dai, that ?? thing is standard SQL or it just works on access?
|
| Maneet Dhungel |
Posted
on 11-Feb-02 03:16 PM
Another thing you can use is the substring function: substr (zipcode, 4,4) - assuming the zip code begins from the first position in the field. Syntax: SUBSTR( field, starting position, ending position)
|
| san |
Posted
on 11-Feb-02 03:46 PM
Hey Santosh, the syntax I gave only works on Access. Each database such as access, sql, oracle have few slightly different syntax. Later
|
| san |
Posted
on 11-Feb-02 03:59 PM
Maneet, if i'm not mistaken I think the syntax of SUBSTR is SUBSTR( field, starting position, length) so in this case it would be SUBSTR(zipcode, 4,1)
|
| Maneet |
Posted
on 11-Feb-02 08:47 PM
San - you could very well be right and I stand corrected. Regards, Maneet
|