select * from custdetails order by shipdate into cursor tmp1 nofilter select * from tmp1 group by customerid into cursor tmp2 nofilter Select shipdate,count(customerid) from tmp2My problem is that I get the late shipdate not the first (if person has shipdate for today and for yesterday he will be counted as yesterday).