I have databse having id and name field. In that I wanted to fetch random names from that database but the records which fetch in 1 st attempt wpuld not repeat in next attempt.
May be this can be done by using some stored precedure or something else i.e. i have to stored those values in some table and apply rules not pick values which is equal to that but i am not getting exact way of doing this.
so please do reply as early as possible.

6 Years
Discussion Span
Last Post by urtrivedi

One query knows nothing about another, so you would have to keep track. Bascially if you add a 'count' column, then you can sort by it, and select random from those. You would have to update the records, so a stored procedure is an option.


"Just only fetching once in select statment and you want to remove that from next select".
I feel this is strange requirement.

But anyway just after select you need to insert same 20 records in some another table, to keep track that this 20 records shown.

Then your select will also reference that second table (where u insert records after selection) for latest query.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.