postgresql jsonb类型查询

select * from (select * from ud_order where user_id=10 and status=2
union
select * from ud_order where user_id=0 and status=2 and order_info->'orderContact'->>'email' = '222@163.com') a where 1=1


select * from ud_order where (user_id=10 and status=2) or (user_id=0 and status=2 and order_info->'orderContact'->>'email' = '222@163.com') order by order_date desc limit 20 offset 0


select * from ud_order where (user_id=10 and status=2 and order_desc like '%t%') or (user_id=0 and status=2 and order_info->'orderContact'->>'email' = '222@163.com' and order_desc like '%t%')

 

order_info 是jsonb类型

参考地址:http://www.linuxidc.com/Linux/2013-12/94354.htm

查看资料:http://www.cnblogs.com/mywebnumber/p/5551092.html

posted on 2016-05-05 14:59  qinyahui  阅读(2511)  评论(0编辑  收藏  举报