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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do a "there were x results, this is first y" result in 1 query?

Status
Not open for further replies.

dcnguyen

Technical User
Mar 22, 2005
54
0
0
US
Let's say I have a database of book entries and I want to only retrieve the first 50 that have a certain author, even though there are more than 200 of them. What I'd like to output is a message saying, "Your search found 2xx results. Here are the first 50"

Is there a way to do this in one mysql query? I know how to do it in two queries, a SELECT...LIMIT 50, and a COUNT query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top