A
Alex_Firenze
Hi all,
Please, help me to find the right query....
I would like to compare, within the same table, the figures related to
a reference date and the previous one...
Example, My table:
referencedate;location;class;npeople
01/01/2005;london;math;100
01/01/2005;london;finance;80
01/01/2005;london;statistics;50
01/01/2005;brighton;statistics;15
01/02/2005;london;math;90
01/02/2005;london;finance;85
01/02/2005;london;statistics;40
01/02/2005;brighton;statistics;12
01/02/2005;brighton;math;15
At the moment I am not able to manage the new entrances.. Indeed my
result is:
pres.referencedate; pres_1.referencedate;location;class;diff_people
01/02/2005;01/01/2005;london;math;-10
01/02/2005;01/01/2005;london;finance;5
01/02/2005;01/01/2005;london;statistics;-10
01/02/2005;01/01/2005;brighton;statistics;-3
But I would expect also the line:
01/02/2005;01/01/2005;brighton;math;15
How can I take into account new Classes or Locations that are appear in
the reference date but not in the previous??
My query:
SELECT pres.referencedate, pres_1.referencedate, pres.location,
pres.class, [pres].[npeople]-[pres_1].[npeople] AS diff_people
FROM pres LEFT JOIN pres AS pres_1 ON (pres.class = pres_1.class) AND
(pres.location = pres_1.location)
WHERE (((pres.referencedate)=#2/1/2005#) AND
((pres_1.referencedate)=#1/1/2005#));
Thank you in advance
Alex
Please, help me to find the right query....
I would like to compare, within the same table, the figures related to
a reference date and the previous one...
Example, My table:
referencedate;location;class;npeople
01/01/2005;london;math;100
01/01/2005;london;finance;80
01/01/2005;london;statistics;50
01/01/2005;brighton;statistics;15
01/02/2005;london;math;90
01/02/2005;london;finance;85
01/02/2005;london;statistics;40
01/02/2005;brighton;statistics;12
01/02/2005;brighton;math;15
At the moment I am not able to manage the new entrances.. Indeed my
result is:
pres.referencedate; pres_1.referencedate;location;class;diff_people
01/02/2005;01/01/2005;london;math;-10
01/02/2005;01/01/2005;london;finance;5
01/02/2005;01/01/2005;london;statistics;-10
01/02/2005;01/01/2005;brighton;statistics;-3
But I would expect also the line:
01/02/2005;01/01/2005;brighton;math;15
How can I take into account new Classes or Locations that are appear in
the reference date but not in the previous??
My query:
SELECT pres.referencedate, pres_1.referencedate, pres.location,
pres.class, [pres].[npeople]-[pres_1].[npeople] AS diff_people
FROM pres LEFT JOIN pres AS pres_1 ON (pres.class = pres_1.class) AND
(pres.location = pres_1.location)
WHERE (((pres.referencedate)=#2/1/2005#) AND
((pres_1.referencedate)=#1/1/2005#));
Thank you in advance
Alex