query most recent date

C

ChrisC

Hi there,

i'm trying to make a query to get the latest price change for my products.

This is what i have in SQL (don't pay attention to the names for i am dutch
speaking):

SELECT Prijsaanpassing.DatPrijsAanp, Prijsaanpassing.EHPrijs,
Prijsaanpassing.Portkosten, Prijsaanpassing.KPInSet,
Prijsaanpassing!EHPrijs+Prijsaanpassing!Portkosten AS Totaalprijs,
Prijsaanpassing.ProductId
FROM Prijsaanpassing
ORDER BY Prijsaanpassing.DatPrijsAanp DESC;

When i run this query i get every price change for every product. I tried to
limit the results by using the group by and max for the date field
(DatPrijsAanp). This works fine as long as the price (EHPrijs) isn't in the
query. Putting both date and price to 'max', gives wrong results.

Any idea how this can be done?

Thanks,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top