Wednesday, March 7, 2012

getting MAX value and displaying record

Hi all,
I basically want to display the single row that has the highest 'jobid' using a SP. I was playing with MAX(jobid) but getting errors about no group by, etc. Where do I begin with this?
SELECT Purchord, JobNo, Descr, customer, jobid
FROM JobsSELECT Purchord, JobNo, Descr, customer, jobid
FROM Jobs
INNER JOIN (SELECT MAX(jobid) jobid FOMR Jobs) HighestID ON Jobs.jobid = HighestID.jobid

-or-

SELECT TOP 1 Purchord, JobNo, Descr, customer, jobid
FROM Jobs
order by jobid desc|||select top 1 Purchord, JobNo, Descr, customer, jobid
from Jobs
order by jobid desc

Edit: beaten!!|||Ohhhh......!!!! Thank you very much guys!|||2 MINUTES 2 LATE, RUDY!

BOO-YAH!

Fastest fingers in the midwest...

No comments:

Post a Comment