Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE stats
- (
- item character varying,
- data jsonb
- );
- it contains values like
- ITEM DATA
- test1 [{"id":"1", "country":"UK"},{"id":"2", "country":"INDIA"}]
- test2 [{"id":"1", "country":"US"},{"id":"4", "country":"CHINA"},{"id":"5", "country":"CHINA"}]
- SELECT * FROM company_products_stats_overseas_view t
- WHERE ( data @> '[{"country":"CHINA"}]')
- and t.product_name ilike '%test%';
- output : [{"id":"1", "country":"US"},{"id":"4", "country":"CHINA"},{"id":"5", "country":"CHINA"}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement