Hi Alan,

Assuming that the "latest period" is unique for each employee,

select employeecode,;
        max(periodcode) as periodcode, ;
        max(pay) as pay, ;
        max(tax) as tax ;
           from paytable ;
          group by employeecode

_Ajit Abraham


        

Alan Bourke wrote:
> VFP=9 SP1
> EngineBehavior=90
> 
> I have a table with employeecode, period, pay, tax.
> 
> The period is in the form '200803' for 2008 period 3. 
> 
> I want one row for each employee, for the latest period available for
> that employee, with the pay and tax fields.
> 
> Which is easy enough to start:
> 
> Select employeecode, Max(periodcode) as periodcode From paytable Order
> By employeeco Group By employeeco
> 
> ... but once I add the pay and tax fields it wants them in the GROUP BY
> as well. This is undoubtedly simple but the pixies* are kicking the
> inside of my head and I can't think.
> 
> 
> 
> * The little fellas like leprechauns, not the popular alt-rockers from
> Boston.
> 
> 


__________________________________________________
D O T E A S Y - "Join the web hosting revolution!"
             http://www.doteasy.com


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to