SQL function for determining index components with weeklys.