2 Replies Latest reply on Sep 12, 2008 9:33 AM by bongobuda

    random results and paging

      Hi guys, I have query which returns random X numbers like:

      SELECT field FROM table
      ORDER BY NewId()

      Now I want to display results in sequence by 2 using "<cfoutput startRow maxRows..>"

      problem is when I display first two records and hit next page refresh and I get different query result set (they get randomized again so I am getting a lot of repeated records)

      Any idea how to solve this, only thing that is coming to my mind is to cache query in session but... there must be better way.

        • 1. Re: random results and paging
          Dan Bracuk Level 5
          What's wrong with making it a session variable? If you are displaying x records per page, you'd have to do something like that anyway.
          • 2. Re: random results and paging
            bongobuda Level 1
            Hi, actually I am displaying always 2 records per page,
            storing query result in session is a bit of a problem (CF setting is that session is active for 12 hours), and requirement is: every site entry to show two different items on page with next prev links to scroll two by two.
            Everything is working just fine, only this next prev links are giving me problems since query refresh and return different set of records (since it is random) so there are duplicates.