This qry returns the wrong C_JobNum and C_PhaseNumber actualy it always returns the 1st record in the table rather than the record the Min statement is returning. Can someone please show me how to make this work correctly?
Thanks,
Mark
Code:
SELECT Min(Abs([C_Longitude]- (-117.61583))+Abs([C_latitude]- 33.967205)) AS NearestJobPhase, C_JobNum, C_PhaseNumber FROM dbo_TblContract GROUP BY C_JobNum, C_PhaseNumber
Thanks,
Mark