Use Partition By to return the MAX record from Join SQL

021633

New Member
I am trying to use and learn Partition By to return the max step number of a one-to-many relationship. Basically, I have one companyID, which is unique in company table. The company has certain steps, which can be however many in the StepCompany table. The companID exists for every step there may exist for that company in the stepCompany table. The steps have StepOrder, which is what I need to use to always return the MAX of those. But I need one single query to return both information from the company and stepCompany based on which step is basically the last step in that company
 
Top