At first I thought I wanted a best seller chart, and that was quite easy, however what I realise I want is to have those figures stored to each item, with a recent sales (i.e. last 7 days) and overall sales.

What kind of method should I use for writing sales figures to an item file?

It's easy enough to do a single update...UPDATE Titles SET RecentSales=(SELECT COUNT(*) FROM Sales WHERE ItemID=@ItemID AND DateSold>GETDATE()-7) WHERE ItemID=@ItemID

... but how should I write a procedure that does this update for all items?

so now for each ItemID you have a Count - aliased as [salesCt] - of the number of [sales].

This data is then JOINed to the table you want to update - [titles]. So now you have access to all the columns in [titles] and also the corresponding columns in the sub-select (which is aliased as [d]).

So now you can just update you [titles] row with any column (or formula using those columns) based on [titles] or [d] - e.g.

set recentSales = d.salesCount

A key aspect of this is that this functions as a SET - so it all happens in one go, rather than iterating around each product in turn, and SQL is very good at that - it will be orders of magnitude quicker that iterating around a loop.

Kristen, thank you very much for the explanation. I have a couple more similar tasks to do so that will help my understanding. I know people criticize SQL's language but I'm impressed by how powerful and concise it can be.