ms access - NOT IN condition in SQL -
can tell me exact syntax not in condition in sql on 2 columns.
this query written in vba.
strnewsql = "select distinct(tblrevrellog_detail.partnumber), tblrevrellog_detail.changelevel, tblrevrellog_detail.id tblrevrellog_detail left join tbleventlog on tblrevrellog_detail.partnumber = tbleventlog.partnumber" strnewsql = strnewsql & " (tbleventlog.partnumber) not in(select tbleventlog.partnumber tbleventlog tbleventlog.eventtypeselected = 'pn removed wrapper') , tbleventlog.trackingnumber = """ & temptrackingnumber & """ , tbleventlog.trackingnumber = tblrevrellog_detail.revreltrackingnumber;"
i want change sub query like, should apply on combination of 2 columns follows:
strnewsql = "select tblrevrellog_detail.partnumber, tblrevrellog_detail.changelevel, tblrevrellog_detail.id tblrevrellog_detail left join tbleventlog on tblrevrellog_detail.partnumber = tbleventlog.partnumber" strnewsql = strnewsql & " (((tbleventlog.partnumber, tbleventlog.partnumberchglvl) not in(select tbleventlog.partnumber,tbleventlog.partnumberchglvl tbleventlog tbleventlog.eventtypeselected = 'pn removed wrapper') , tbleventlog.trackingnumber = """ & temptrackingnumber & """ , tbleventlog.trackingnumber = tblrevrellog_detail.revreltrackingnumber);"
but not working.....
you can't use in
more 1 column can achieve same effect using exists
:
select * tbl1 not exists ( select * tbl2 tbl2.col1 = tbl1.col1 , tbl2.col2 = tbl1.col2 )
Comments
Post a Comment