ms access - Can I use 'like' to compare to a field in another table? -


i have 2 tables - tmasks , tfiles, each 1 (relevant) field - [mask] , [filename] respectively.

sample data , expected result

for tmasks have [mask] values of '60moelg', 'adjclmrp', , 'arerrdoc'.

and tfiles have [filename] values of '60moelg_00', 'aut_cnty', 'exvndata00', , 'adjclmrp00'.

what need list of [filename] values in tfiles there no matching [mask] value in tmasks. (so in limited sample here, result {'aut_cnty', 'exvndata00'}.)

what have tried

i trying along lines of:

select filename tfiles filename not in (select filename tfiles, tmasks  filename ('mask' & '%')); 

but doesn't work, because

select filename tfiles, tmasks filename ('mask' & '%')  

returns empty set, , not in doesn't eliminate anything.

do need import these columns vba array variants , 'brute force' via for..each loop, or can select? seems should can select, i'm not making leap....

(in 'real world', tmasks less 300 records, while tfiles on 1400 records, , ultimate point update (and maintain!) tmasks there no members of tfiles there not matching mask in tmasks. , make more 'interesting', cannot use 'equals' instead of 'like', because number of characters in mask isn't consistent. masks have 8 chars, 7, 6. can't compare masks left(filename, n) using = operator, because n vary.)

i stuck - suggestions? in advance!

remove quotes 'mask'. don't want string of mask, want value of mask. changed & + since sql server (2012) doesn't allow & nvarchar data types.

select filename tfiles  filename not in  (select filename tfiles, tmasks filename (mask + '%')); 

i set described scenario on database , returned 2 rows:

filename aut_cnty exvndata00 

good luck!


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -