[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

t-sql max date function

I need to create a query that will return a employeeID, MAx(date) and jobchangereason
I need to allow all max dates where = 100
but no max dates on all other values in the same column

create table variable
insert into table variable
select  eeid, max(date). jobchange reason from mytable m
join  another table n
on n. eeid = m. eeid
where jobchangereason = 100
0
asullivan62
Asked:
asullivan62
1 Solution
 
Barry CunneyCommented:
create table variable
insert into table variable
select  eeid, max(date). max(jobchange reason) from mytable m
join  another table n
on n. eeid = m. eeid
where jobchangereason = 100
group by eeid
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
 
asullivan62Author Commented:
thats exactly how I did it.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now