No, no. You misunderstand. But I found the solution.
I am trying to return a cursor with the count of the number of records in each group.
Instead of:
1 2006-01-03 00:00:00.000 0 135 WEST 1
2 2006-01-03 00:00:00.000 0 135 WEST 1
3 2006-01-03 00:00:00.000 0 135 WEST 1
4 2006-01-03 00:00:00.000 0 135 WEST 1
5 2006-01-03 00:00:00.000 0 135 WEST 1
I want back:
1 2006-01-03 00:00:00.000 0 135 WEST 5
The solution was to remove the Id column.
Thanks again Sergey!
>There's a big difference between 'works' and 'produces correct result'. The VFP query doesn't guaranty that result will be correct under all conditions because non-grouped, non-aggreagate fields are comming from the last phisycal record in a group. You can use MAX() function if you want the highest ID. See corrections inline.
>
>>Ok, now I'm getting results, but it's not what I want. This works in my VFP version.
>>
>>Here's what I'm getting back:
>>
>>
>SELECT MAX(r.id) AS ID,
>> r.transaction_date,
>> 0 as batchid,
>> r.telemrkt_company,
>> t.company_code,
>> count(*) as Cnt
>>FROM result_detail r
>>JOIN telemrkt_company t on r.telemrkt_company = t.id
>GROUP BY r.transaction_date, r.telemrkt_company, t.company_cod
>>
>>
>>1 2006-01-03 00:00:00.000 0 135 WEST 1
>>2 2006-01-03 00:00:00.000 0 135 WEST 1
>>3 2006-01-03 00:00:00.000 0 135 WEST 1
>>4 2006-01-03 00:00:00.000 0 135 WEST 1
>>5 2006-01-03 00:00:00.000 0 135 WEST 1
>>
>>
>>Problem is, I need back one record with a count of 5. Because the Id is required, the
>>records are not grouped into one.
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people