This seems like an easy thing, but I’m drawing a blank.
Select * from
....
inner join
(
select JobsID, Value from Jobs where Value **is the highest**
) as MaxJob on MaxJob.CustID = A.CustID
inner join
(
select other information based upon MaxJob.JobID
) as OtherStuff
Is there a nice way to have that first subquery give me the Job ID of the job with the maximum Value?
Thanks… this seems easy and I’m sure I’m overlooking something very elementary. One of those days…
Edit: Due to this question being a bit ambiguous, I’ve written up a much more detailed question here (since this question was answered correctly).
If you want the single JobId with the highest Value:
But, that may give you multiple JobIds if thay all have the same Value. So, assuming you don’t want that, I’d probably do: