"why is mysql returning the same results while using rand() in the select statement?" Code Answer

3

you are probably receiving information from the mysql query cache in some result sets.

try this:

select sql_no_cache *
       /* etc */

beware: put the sql_no_cache word on the same line as the select and the * (or the name of the first column you are selecting).

see this: http://dev.mysql.com/doc/refman/5.1/en/query-cache.html it says,

the query cache stores the text of a select statement together with the corresponding result that was sent to the client. if an identical statement is received later, the server retrieves the results from the query cache rather than parsing and executing the statement again. the query cache is shared among sessions, so a result set generated by one client can be sent in response to the same query issued by another client.

pro tip: avoid select * in software. give the names of the columns you need in the result set.

By Ikaro0 on June 18 2022

Answers related to “why is mysql returning the same results while using rand() in the select statement?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.