I am getting elements from MySQL by using this query;
select * from bahis where onay='1' or onay='2' order by rand()
But elements can be same with this query. For example I have 3 values that matches with this query, A,B,C
it can generate A A B or A B C or A B B
But I want to generate them like A B C or C B A or B A C.
How can I do that?
As written, your query will not output any individual row more than once — it will just return every row in a random order. If you’re getting duplicates in the result, then your table must contain duplicates; if this is correct, and you just need to suppress them, use the
DISTINCTmodifier (e.g,SELECT DISTINCT * ...).