seems i did not explain correctly
i need it to look at the range between appfrom and appto.
if appfrom =0 and appto = 6 then the numbers within this range is 0,1,2,3,4,5,6.
so the results would be as originally posted.
need it to be hardcoded so the query can be used to build on for final...