Possible Duplicate:
Retrieving the last record in each group
Hi all i am having my table data as follows
ID FedTaxID RegularPay Payperiodnumber
1 562545366 500 1
2 562545366 501 1
3 562545366 5000 2
I would like to get my data as follows
ID FedTaxID RegularPay Payperiodnumber
2 562545366 501 1
3 562545366 5000 2
I tried some thing like as follow but i am not getting the required result
select max(id) ID,regularpay,fedtaxid,payperiodnumber
from tblemployeegrosswagesn1 where fedtaxid="562545366"
group by payperiodnumber
having count(*) >= 1;
Can any one help me