Hi guys/gals, I need to write a query which finds out the second highest value for a company.
I have two tables, "A" and "B". A stores company names, and B holds the sales and each value.
The tables are linked by A.COID =B.COID.
What I need is the second highest sale for each company. naturally select max(b.value) returns the highest sale, so how do I manipulate this to get the second highest?
If you have any bright ideas, please send them on a postcard to... ;-)
I have two tables, "A" and "B". A stores company names, and B holds the sales and each value.
The tables are linked by A.COID =B.COID.
What I need is the second highest sale for each company. naturally select max(b.value) returns the highest sale, so how do I manipulate this to get the second highest?
If you have any bright ideas, please send them on a postcard to... ;-)