Home > database > Oracle determine whether a field value is contained in another table
Oracle determine whether a field value is contained in another table
Time:10-02
For example: A table Field (primary key) 2 1 the ABC; Def 2, 123; 456 Table B Field (primary key) 2 3 the abcd 4 456 Determine if A table field with A semicolon 2 values in table B, there are not record, and record the data. Example returns A table data 1 the ABC 1 def 2 123 Consult the SQL how to write
CodePudding user response:
Determine if A table field with A semicolon 2 values in table B, there are not record, and record the data. Example returns A table data 1 the ABC 1 def 2 123
Why didn't see this logic will return this data?
CodePudding user response:
1 def
This data, it is according to the rule contains?
CodePudding user response:
The select a.c ol1, biggest ol2 From a, b Where instr (a.c ol2, biggest ol2) & gt; 0;
More a little bit more simple is instr, is on the case, but there are defects, such as table fields is ab, b instead of ABC will match to Complex is the field in a table for 2 whole column, and then an exact match table field 2 b