>Hi,
>I've got Your mail, Thanks a lot.
>Here a example of my SQL command
>SELECT V_thop_b.ten_bao,;
> MIN(V_thop_b.ck_from+V_thop_b.to_dk+V_thop_b.dauky-V_thop_b.cuoiky,;
> V_thop_b.dauky,V_thop_b.cuoiky);
> FROM fabaco!v_thop V_thop_b;
> WHERE V_thop_b.ck_from >= 1;
> AND V_thop_b.to_dk >= 1;
> GROUP BY V_thop_b.ten_bao
>
>When I add expression MIN(,,) to selected field, I always get "MIN(,,)" in selected field (View designer put function MIN into "", even if I type MIN(2,1) and add to selected fields) . Can You help me. Thanks very much. Phuong
The MIN() function in SQL Select is not the same MIN() function you may encounter elsewhere in VFP. It takes only one parameter, and calculates the minimal value of that parameter per group level. It's actually an aggregate function like SUM() or AVG(). If you want a function to calculate a minimum between two or more expressions, you better select all of them in separate columns, and a spare column to keep the result. Then, USE the cursor AGAIN IN 0, and replace the spare column with (regular VFP) MIN(field1, field2, field3).