Wednesday 15 February 2012

Mysql two varchar column data range -



Mysql two varchar column data range -

i trying compare inbetween value of 2 varchar column in mysql

i have 2 columns col1 , col2 both varchar type both having alphanumeric values , want compare provided value in between or not

for illustration col1 value 'l7j0a1' , col2 value 'l7j3b7' , if provided 'l7j0a2' value should homecoming single row range contains 'l7j0a2' value

select * gojit_postalcode_zone_mapping 'l7j0a1' between from_postal_code , to_postal_code;

this won't work because have provided value 'l7j0a1' mysql looking column name. judging think want how it:

select * postalcode_zone_mapping col1 < 'l7j0a1' , col2 > 'l7j0a1'

if want inclusive utilize =< , >= instead. if doesn't accomplish must misunderstanding asking.

mysql

No comments:

Post a Comment