in reply to Finding best matches

G'day Scotsman,

Welcome to the monastery.

If you've come here to ask a purely SQL question, you're basically in the wrong place. However, assuming you've extracted that data (e.g. via DBI or similar) into Perl data structures, then this might do what you want:

$ perl -Mstrict -Mwarnings -E ' my @source_data = ( ["Archeologist", "Ancient projects", "Cairo"], ["Architect", "Major projects", "London"], ["Architect", "Small projects", "Sydney"], ["Architect", "Small", "Hong Kong"], ["Programmer", "Big", "Hong Kong"], ); my @search_data = ("Architect", "Hong Kong", "Small"); my @found_data; my $re = "(?:" . join("|", @search_data) . ")"; for (@source_data) { my $matches = 0; /$re/ && ++$matches for @$_; push @found_data, [$matches, $_] if $matches; } say "@{$_->[1]}" for sort { $b->[0] <=> $a->[0] } @found_data; ' Architect Small Hong Kong Architect Small projects Sydney Architect Major projects London Programmer Big Hong Kong

If you have follow-up questions, that's fine, but please read the "How do I post a question effectively?" guidelines before posting them.

-- Ken