Hi all,
I have a table CARS that model cars coming in and out of a dealership.
(This is oversimplified)
create table cars(VIN varchar(50) not null primary key, location_id
int not null, inDate date not null, outDate date)
Every time I buy a new car it's gonna show in the log with the inDate
as today's date, every time i sell it, the outDate gets upated (from
null to current date).
I want to write a query to retrieve the number of cars bought and sold
daily over a period of time grouped by locations
For instance
06/06/07 somelocationid 10 in 8 out
06/06/07 someotherlocationid 2in 3 out
06/07/07 ..........
The results will end up in some sort of a fact table (i'm not sure
here if it's better to keep all days in this fact table - even those
that have 0 out 0 in or just skip the dates i have no flow - the fact
table will be used to compute all sort of trends over time etc)
thanks