php - Mysql query for searching keyword -


i have search keyword , searching keyword using 2 tables.

the search keyword 'patient'

table - default_pages

id        type_id     parent_id         status 68        16          0                 draft 70        17          68                live 227       17          44                live 262       1           31                live 

table - default_search

id       title                 entry_id 1        patient status        70 2        patient check         227 3        patient health        262 

my query

"select              s.title, p.id, p.type_id sqem               default_search s left join default_pages p on p.id=s.entry_id                s.title '%patient%'               having sqem not null" 

the above query returns 3 results ids default pages 70, 227, 262 problem id 70, it's parent id 68 , status of id 68 draft want exclude row result set , stuck.

any highly appreciated. in advance.

check status in default_pages table:

select  s.title, p.id, p.type_id sqem  default_search s left join default_pages p on p.id=s.entry_id   s.title '%patient%' , p.status='live' having sqem not null 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -