Reputation: 3917
I am trying to write this query:
SELECT DISTINCT createdcfgid FROM ab WHERE (createdcfgid ~ ‘^[0-9]+$’)
This results in
syntax error at or near "[" LINE 3: WHERE (createdcfgid ~ ‘^[0-9]+$’)
Anyone there who can give me a clue about what I am doing wrong?
Thanks in advance
Upvotes: 0
Views: 139
Reputation:
It does just look like you are using the wrong quotes, try '
rather than ‘
:
PostgreSQL 8.4 Schema Setup:
create table ab(createdcfgid text);
insert into ab(createdcfgid) values ('111');
Query:
SELECT DISTINCT createdcfgid FROM ab WHERE (createdcfgid ~ '^[0-9]+$')
Results:
| CREATEDCFGID |
----------------
| 111 |
this on SQL Fiddle
Upvotes: 1