Question : Help in Defining query in Access

Hi All,

I'm just bit struck at this query as i bit need to refine it further to get what I'm looking for, Now i have this query with me, iT Works perfectly without any flaw.

But i just need to modify this query to give as in add four more columns in it of PDC,CASH,PCASH and NCASH only which will show figures of second max date or i can also say max(dateva)-1

So can i do that in the same query?? If not then what will be the separate query for it as Im struggling to build that myself.

Saurabh
Code Snippet:
1:
2:
3:
4:
SELECT Btable.MonthName, tblAlignment.TeamNo, Btable.CC, tblAlignment.Alias, tblAlignment.RealName, tblAlignment.GM, tblAlignment.CM, tblAlignment.Division, tblAlignment.BOM, tblAlignment.Goal, Btable.PDC, Btable.Cash, Btable.PCASH, Btable.Ncash
FROM Btable INNER JOIN tblAlignment ON (Btable.MonthName = tblAlignment.MonthName) AND (Btable.CC = tblAlignment.CC)
WHERE (((Btable.DateVa) In (SELECT Max(Btable.DateVa) AS MaxOfDateVa FROM Btable)))
GROUP BY Btable.MonthName, tblAlignment.TeamNo, Btable.CC, tblAlignment.Alias, tblAlignment.RealName, tblAlignment.GM, tblAlignment.CM, tblAlignment.Division, tblAlignment.BOM, tblAlignment.Goal, Btable.PDC, Btable.Cash, Btable.PCASH, Btable.Ncash;

Answer : Help in Defining query in Access

I've returned the mdb below with 6 queries, 5 of which I use in the development.
qryOrig - your original query
qryAliases - your original query with aliases

Then I realized we were carrying around a lot of baggage that could be added later so I got rid of a wack of fields:

qryAliasesMinFlds

Then I created a query using the Max(DateVa) - 1 concept:

qyrAliases|MinFldsPreDate

Now just simply join the two queries:

qryAliasesMinFldsBothDays

Tell me if qryAliasesMinFldsBothDays gives you the right numbers.
 
pls run qryAliasesMinFldsBothDays
 
Random Solutions  
 
programming4us programming4us