Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show 1st 3 and last 3 records 2

Status
Not open for further replies.

webware

Technical User
May 27, 2002
6
US
I am running the following Query and was wonder how to add to this in order that I can display the first 3 and last 3 records.

SELECT house.P1, Count(*) AS EXPR
FROM house
GROUP BY house.P1
HAVING (((Count(*)+1)<>False))
ORDER BY Count(*);

Thanks to anyone that can help
 
You could try 2 queries, not sure about doing in 1 query.

SELECT TOP 3 house.P1, Count(*) AS EXPR
FROM house
GROUP BY house.P1
HAVING (((Count(*)+1)<>False))
ORDER BY Count(*);

SELECT TOP 3 house.P1, Count(*) AS EXPR
FROM house
GROUP BY house.P1
HAVING (((Count(*)+1)<>False))
ORDER BY Count(*) DESC;

 
And in 1 query....

SELECT TOP 3 house.P1, Count(*) AS EXPR
FROM house
GROUP BY house.P1
HAVING (((Count(*)+1)<>False))
ORDER BY Count(*);
UNION
SELECT TOP 3 house.P1, Count(*) AS EXPR
FROM house
GROUP BY house.P1
HAVING (((Count(*)+1)<>False))
ORDER BY Count(*) DESC;

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top