0

I have very little experience in database management but have come across a problem I am unable to find a solution to online. I currently have access to a database which is updated in real time with the most recent sales figures for a company. In simple terms it looks like this on 01/09/2016:

Sales
50

I wish to make a CSV report which takes the sales levels from the live database each week and inserts them as a new row in the CSV file. In order to track the report date, I had planned to add a new column named 'Report Date' with the date of report update listed for each observation taken from the live database.

The desired output would have a format similar to

Report Date     Sales
01/09/2016      50
08/09/2016      70
15/09/2016      79

It would be good to know what people think is the best method to produce this type of dataset. If there are any options that involve SQL that would be good, but open to any method that does the job.Let me know if any more information is needed!

1

If I understand your question correctly ... you are trying to store the Report Date and Sales Value in a CSV file on a weekly schedule.

Why not save this information in your database? Have a scheduled job run a query to produce your sales numbers. That scheduled job would insert the Report Date and Sales number into a database table. That way you don't have the sales numbers in an external CSV file.

When you want to check the report date you just have to run a simple query to pull back that information. Let me know if I'm missing the boat.

*** EDIT **** In your post you said "I have access to a database". I suppose I should have first asked if this was an "Access Database" or a "SQL Server Database".

  • Yes the output would work well inside the database. It is a Microsoft Access database. As I am currently teaching myself SQL I plan to produce the report in sql mode. Would you consider this to be a fairly simple task inside of Microsoft Acess? Thanks for all your help with this! – George Dec 20 '16 at 19:07
  • Yes this should be an easy task. A single table with two columns (ReportDate , Sales). Then you just have to create and run an INSERT command when you run your report. – S. Lloyd Dec 23 '16 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.