Here rmid is looks like '1,2,3,4,5,6'
select
*
from
menu m
left outer join roles r
on
r.rid = 3
where
select
m.mid
in
(select
regexp_split_to_table(r.mid,',')::int
)
Another example,
SELECT
foo
FROM
regexp_split_to_table('the1quick2brown3fox4jumped over the,lazy,dog',E'[\\,\\\s1-9]+') AS foo
Ref: http://www.postgresql.org/docs/8.3/static/functions-matching.html
select
*
from
menu m
left outer join roles r
on
r.rid = 3
where
select
m.mid
in
(select
regexp_split_to_table(r.mid,',')::int
)
Another example,
SELECT
foo
FROM
regexp_split_to_table('the1quick2brown3fox4jumped over the,lazy,dog',E'[\\,\\\s1-9]+') AS foo
Ref: http://www.postgresql.org/docs/8.3/static/functions-matching.html
No comments:
Post a Comment