>Hi Mark,
>
>> group by &cGroupBy ;
>> order by &cOrderBy ;
>
>Just an addition, I would add the "GROUP BY" to the variable, otherwise, if its dynamic it may be empty, and may couse an error.
>
>
lcGroupBy = iif(empty(cGroupBy), '', 'group by ' + cGroupBy)
Good point. Same goes for ORDER BY.
Mark McCasland
Midlothian, TX USA