speed up action sql
replaced "where ... in ..." with "join"