Running a query against it's own base table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am developing an application which is sort an inventory system. What I need
to do is load last month or weeks data minus the new product additions. This,
I want to leave blank for obvious reasons, however, I do not wish to have to
re-enter all the same data again. The data structure and product remain the
same through-out the week, month or years with minor additions. Is it
possible to use a query to load last month or weeks data into the same table
leaving the Add/Count column blank and then, tag the update with the date in
the date column in which the update was done?

I know I've seen it some place before, is it possible. If so, how?

Thanks,
 
It would help if you could post the fields in the table in question: it is
certainly possible, but how you go about it depends a lot on whether you have
the month or week in the table. Something like this:

INSERT INTO Inventory ( DateColumn, Product )
SELECT Now() AS UpdateDate, Inventory.Product
FROM Inventory
WHERE (((Inventory.DateColumn)>=[Enter Start Date]) AND ((Inventory.
DateColumn)<=[Enter End Date]))
GROUP BY Now(), Inventory.Product;

If you want to automate this some more, you need to figure out you are going
to determine last month or last week from the current date - still not too
bad. This also puts a Date & Time in the DateColumn, which you can change by
using the DateSerial and Now() functions together.
 
Back
Top