Monday, March 19, 2012

getting results between 10 and 20

Here is my query
SELECT ItemName,ItemDesc FROM CATAGORY
This query returns over 80 results but I only need the results between 10 and 20 how can I modify the query to do that?SELECT ItemName,ItemDesc FROM CATAGORY WHERE ItemDesc between 10 and 20|||hmmmm...that query seem to return no results. here is an example:

table:

ItemsID ItemDesc Price Catagory
1 Binoculars $100 Hunt
2 Boots $20 Hunt
3 Camoflauge $59 Hunt
4 Whistle $5 Hunt
5 PLastic Bags $300 Specialty
6 Rifle $800 Hunt
7 Bate $.59 Fish
8 Salt $2.00 Fish

Take this table for example my query returned all results for catagory "Hunt" but I only want the results that are between 2 and 4.

The results that are being retured are too much to display in a webpage so I am trying section the information by pages. Page 1, page 2, page 3

SELECT ItemName,ItemDesc FROM CATAGORY WHERE ItemDesc between 10 and 20

The query above does not return any results. I am puzzled :confused:|||Cast ITEM as an integer. You are doing string comparisons on numeric values.|||hmmmm...I am not trying to do a string comparison. I am only trying to get data "page by page".

For example if a certain query returns 1000 rows. Well I want to display row 20 through 30 because the user is on page 3. Anyone have any ideas?|||OMG, paging -- it sure didn't sound like that at the beginning of this thread ;)

see http://rosca.net/writing/articles/serverside_paging.asp|||I thought ItemDesc was an integer !
of course it cannot work

as says r937 you have never said it was for paging|||hey thanks fellas its working now i appreciate all the responses

And sorry about the misunderstanding

No comments:

Post a Comment