SQL语句

"select * from (select json_data.value as a from '%s' as t, jsonb_each(t.value) AS json_data where ne_id = %d and attached = %d) \
                                as foo where concat(a) like '%%%s%%';"\
                                
SELECT t.value FROM table_all as t, jsonb_each(t.value) AS json_data  where concat(json_data.value) like '%xu%' and ne_id = 1 and attached = 0;

select ss.id,ss.ne_id,ss.attached,ss.name, neinfo.nename, ss.dev_authsrv_name from ss INNER JOIN neinfo ON ss.devid = neinfo.id
;
select * from (select ss.id,ss.ne_id,ss.attached,ss.dev_authsrv_name, neinfo.nename, ss.name from ss INNER JOIN neinfo ON ss.devid = neinfo.id)  as foo where  foo.ne_id = 1 and foo.attached = 0
;
SELECT t.value->>'ip_segment', t.value->>'desc' FROM table_all as t, jsonb_each(t.value) AS json_data ;
SELECT t.value FROM table_all as t, jsonb_each(t.value) AS json_data where t.value->>'ip_segment' like '%aa%' or t.value->>'desc' like '%predd%' ;
SELECT
    *
FROM tableall as t, jsonb_each(t.value) AS json_data where json_data.value like '%xxx%'
            select_sql = "SELECT t.value FROM %s as t, jsonb_each(t.value) AS json_data  where concat(json_data.value) like '%%%s%%' and ne_id = %d and attached = %d;"\
                      %(table,  self.body['search_key'], self.env.ne_id, self.env.attached)

posted on 2016-05-23 13:59  与非朋仔  阅读(224)  评论(0编辑  收藏  举报

导航