mysql - why two sql giving different result? -


i confused here first sql-

i have 1 entry in cnt_content table content_pk=5419441 , title=test wls-2

now when running sql 1-

select    title,    content_pk     cnt_content c     c.type not in (       'amt', 'lpa', 'que'    )     , c.private_flag = 'n'     , c.searchable_flag = 'y'     , c.status in (       'pub', 'nap'    )     , (       trim(c.title) 'test wls-2'        or trim(c.special_keyword) 'test wls-2'    )      , not exists (       select          1                 cmd_content_metadata cmd                 cmd.content_pk=5419441           , cmd.for_others='y'     )   order    c.last_modified_date desc; 

it giving result-content_pk=5419441 , title=test wls-2

but when running sql 2-

select    title,    content_pk     cnt_content c     c.type not in (       'amt', 'lpa', 'que'    )     , c.private_flag = 'n'     , c.searchable_flag = 'y'     , c.status in (       'pub', 'nap'    )     , (       trim(c.title) 'test wls-2'        or trim(c.special_keyword) 'test wls-2'    )      , not exists (       select          1                 cmd_content_metadata cmd                 cmd.content_pk=c.content_pk           , cmd.for_others='y'     )   order    c.last_modified_date desc; 

it not giving result. please explain.

because in 1 giving specific value content_pk 5419441, while other 1 uses corelated query means each , every value of content_pk selected in outer query, checking equality in sub select query.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -