create cursor x1 ( wo i, punch d ) insert into x1 values ( 1, {^2005-1-1} ) insert into x1 values ( 1, {^2005-1-6} ) insert into x1 values ( 1, {^2005-1-8} ) insert into x1 values ( 2, {^2005-1-3} ) insert into x1 values ( 2, {^2005-1-6} ) select wo, ( max( punch ) - min( punch ) ) + 1 as duration ; from x1 ; into cursor howlong ; group by wofiltering out weekends from the duration is a lot rougher. I'll work some more on that later this evening.
>WO Date >1 1/1/05 >1 1/6/05 >1 1/8/05 >2 1/3/05 >2 1/6/05 >etc>