SQL Group Query where money
Posted on 2011-09-25
I have a table that records each time a 'job' changes the sales value. I want to pull out the most recent record to show the current sales value of a particular job.
My grouping query returns more than 1 record (where more than 1 record exists) as I cannot sum the Rate field - I only want to show the actual content of the field, not sum all of the them!
select max(JobChargeId) As JobChargeId, JobId, Rate from JobCharges
where jobid = 4006223
group by JobId <and I only ant to show the most recent Rate by maximum JobChargeId>
How can I group on the Rate field withoyt summing it, to return only 1 record?