mardi 11 juillet 2017

mysql coupled OR statement

I'm trying to do a coupled OR statement

select * from table where cat = "x" OR (cat = "y" AND rand()<=0.25);

So I would like to select all items with cat = x or cat = y, but only 25% of y. The statement above gives med 25% of both x and y.

How can I seperate my statement so this can be done?

Thanks




Aucun commentaire:

Enregistrer un commentaire