开发者

HEX where clause in Postgre

I'm new in postgreSQL

how to d开发者_运维知识库o this

select * from table_abc where table_abc.a>=7a and table_abc.b<=7a

all value is HEX in column a, b and input value

Thanks

EDIT :

table_abc

a bytea
b bytea
c text


Careful, here. In Postgres, bytea is a byte array. You look like you want to store a single byte in those columns.

I don't see a single-byte type in the list of datatypes at http://www.postgresql.org/docs/9.0/static/datatype.html.

You can go with an integer type. For example, when I say this:

select x'7A'::integer

I get 122.

If you intend to store a single byte in these columns and write your queries with hex values, then I suggest you make the columns integers and query like this:

select * from table_abc where table_abc.a>=x'7a'::integer and table_abc.b<=x'7a'::integer
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜