MS Access - how to get 30-day date range

Asked

Viewed 724 times

0

I need to collect registered orders from a table with the name Pedidostalao in the last 30 days.

  • 2

    Welcome to Stack Overflow! Please include more information to clarify your question, such as your table fields, previous attempts, etc. Visit the [Ask] page for more information.

1 answer

0


In your query, use the expression SomData() (or DateAdd() in Access in English) as a criterion in the column of the following date form:

>= SomData("d"; -30; Data() )

He makes a WHERE field returning all the dates of the last 30 days. The field type should be Data

  • Obg for the tips +gmsantos, and I solved like this: SELECT pt.id as Pedidos, pt.Data FROM (Pedidostalao pt INNER JOIN Sub ON pt.ID = sub.Idrequest) INNER JOIN Customers cli ON cli.Code = en.Client WHERE cdate(format(en.Date,'mm/dd/yyyy')) between Date() - 30 and Date() ORDER BY 1 DESC

Browser other questions tagged

You are not signed in. Login or sign up in order to post.