adding after,before query on mapping table