Selasa, 09 Januari 2018

Re: [MS_AccessPros] Re: Max Date and Max Sequence

 

Bill,

I do not know why these queries are make table queries. I Look at the way the process is and think that if I could do it in one query. and bypass all of this stuff. Sometimes my boss took the long road home because it was safer I guess.

Thank You

qry_23TermsMAXDate

SELECT TermsOrTransfersOut.[Person Nm], TermsOrTransfersOut.[Person Id], Max([R&D-EMPLOYEEHISTORY].Effdt) AS MaxOfEffdt INTO TermsMaxDate
FROM [R&D-EMPLOYEEHISTORY] INNER JOIN TermsOrTransfersOut ON [R&D-EMPLOYEEHISTORY].[Person Id] = TermsOrTransfersOut.[Person Id]
GROUP BY TermsOrTransfersOut.[Person Nm], TermsOrTransfersOut.[Person Id], [R&D-EMPLOYEEHISTORY].[Hr Stat Cd]
HAVING ((([R&D-EMPLOYEEHISTORY].[Hr Stat Cd])="I"))
ORDER BY TermsOrTransfersOut.[Person Nm];


qry_23ATermsMAXDateMaxSeq

SELECT TermsMaxDate.[Person Nm], TermsMaxDate.[Person Id], [R&D-EMPLOYEEHISTORY].Effdt, Max([R&D-EMPLOYEEHISTORY].Effseq) AS MaxOfEffseq1 INTO TermsMaxDateMaxSeq
FROM TermsMaxDate INNER JOIN [R&D-EMPLOYEEHISTORY] ON (TermsMaxDate.[Person Id] = [R&D-EMPLOYEEHISTORY].[Person Id]) AND (TermsMaxDate.MaxOfEffdt = [R&D-EMPLOYEEHISTORY].Effdt)
GROUP BY TermsMaxDate.[Person Nm], TermsMaxDate.[Person Id], [R&D-EMPLOYEEHISTORY].Effdt, [R&D-EMPLOYEEHISTORY].[Hr Stat Cd]
HAVING ((([R&D-EMPLOYEEHISTORY].[Hr Stat Cd])="I"))
ORDER BY TermsMaxDate.[Person Nm];



Jim Wagner
          

On ‎Tuesday‎, ‎January‎ ‎9‎, ‎2018‎ ‎09‎:‎24‎:‎02‎ ‎AM, wrmosca@comcast.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

Jim

Can you post the SQL for each queryk? Usually when you need two different Max fields you can join the two or use a UNION, but without seeing what you have now I can't give you a definitive answer.

-Bill


---In MS_Access_Professionals@yahoogroups.com, <luvmymelody@yahoo.com> wrote :

Hello all,


I am looking at these 2 queries that are run to get max Eff dt and Max Eff sq. They are in 2 queries. can these be run in only one query to get the max Eff dt and max Eff sq?


Thank You

Jim Wagner

__._,_.___

Posted by: Jim Wagner <luvmymelody@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar