David_Skov
Active Member
- Joined
- Jun 29, 2004
- Messages
- 267
I succeded in making my database (with help from you in here :wink but I have a small issue that you might be able to help me with.
I have a query that looks like this:
SELECT TOP 250 test.ButiksID, test.Butiksnavn, Sum(test.Q2) AS [Total Q2], Sum(test.Q1) AS [Total Q1], Sum(test.Q4) AS [Total Q4], Sum(test.Q3) AS [Total Q3], Sum([q2]+[q1]+[q4]+[q3]) AS Total, Kædetabel.Kæde
FROM test INNER JOIN Kædetabel ON test.ButiksID=Kædetabel.ButiksID
GROUP BY test.ButiksID, test.Butiksnavn, Kædetabel.Kæde
ORDER BY Sum([q2]+[q1]+[q4]+[q3]) DESC;
Each quarter of a year I enter new data into my database. Among the data is 'Year' (not seen or used in the query) and 'Quarter' (Q1-Q4 above). In my reports I only need the last four quarters. So now I need these quarters:
Q204 - Q104 - Q403 - Q303 (already in the database and in my query above)
When September is finished I get new quarterly data, and therefor my reports should only include:
Q304 - Q204 - Q104 - Q403
So Q303 will not be needed in this query anymore, instead Q304 is needed. In January 2005 the query should only include:
Q404 - Q304 - Q204 - Q104
Etc.
I have no real good idea to solve this puzzle but assume it can be handlede some way in a query or?
Anyway, any help is really appreciated
Inadvance tx ray:
I have a query that looks like this:
SELECT TOP 250 test.ButiksID, test.Butiksnavn, Sum(test.Q2) AS [Total Q2], Sum(test.Q1) AS [Total Q1], Sum(test.Q4) AS [Total Q4], Sum(test.Q3) AS [Total Q3], Sum([q2]+[q1]+[q4]+[q3]) AS Total, Kædetabel.Kæde
FROM test INNER JOIN Kædetabel ON test.ButiksID=Kædetabel.ButiksID
GROUP BY test.ButiksID, test.Butiksnavn, Kædetabel.Kæde
ORDER BY Sum([q2]+[q1]+[q4]+[q3]) DESC;
Each quarter of a year I enter new data into my database. Among the data is 'Year' (not seen or used in the query) and 'Quarter' (Q1-Q4 above). In my reports I only need the last four quarters. So now I need these quarters:
Q204 - Q104 - Q403 - Q303 (already in the database and in my query above)
When September is finished I get new quarterly data, and therefor my reports should only include:
Q304 - Q204 - Q104 - Q403
So Q303 will not be needed in this query anymore, instead Q304 is needed. In January 2005 the query should only include:
Q404 - Q304 - Q204 - Q104
Etc.
I have no real good idea to solve this puzzle but assume it can be handlede some way in a query or?
Anyway, any help is really appreciated
Inadvance tx ray: