Hi,

I need to fetch 5th top and 6th max from my database table...

asssume everything are integer datatype.

Thanks

HI lyardson

I think this querry is helpfull for you

Table name forums

id name
1 \N
12 a
15 r
18 u
32 s
21 a
2 v


Querry :

SELECT A.6thmax, B.5thtop
FROM
(
 SELECT id AS 6thmax FROM forums ORDER BY id DESC 
) A,
(
 SELECT id AS 5thtop FROM forums LIMIT 4, 1
) B
LIMIT 5, 1;

Output :

6thmax 5thtop
2 32

Regard

Sauarv

If it's help full for u then marked as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.