• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

Show Query Output in Single Row

I have a table that records each time the price of a job is created or subsequently amended, eg:

Id      JobId       Rate
1       100123     90.00
2       100123     85.00
3       100123     75.00
4       100124     80.00
5       100124     85.00
6       100125     90.00

I want to report on is the highest and lowest rates per job, so:

Required output:

JobId        HighestRate         LowestRate
100123     90.00                   75.00

Any help would be appreciated!



100124     85.00                   80.00
100125     90.00                   90.00
1 Solution
Try this.
select jobId,Max(Rate)  HighestRate,min(Rate) LowestRate from tmpTable group by jobid

Open in new window


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now