mercredi 27 septembre 2017

Purpose random mix of data

I have one table vehicle_info.

m_id, x,            y,          z,        a
426,  2151.3999,    987.5999,   10.6,     0.0
415,  2132.8999,    1009.9,     10.6,     269.5
429,  2132.8999,    1025.8,     10.6,     270.0
411,  2163.3999,    1016.2,     10.6,     90.0
402,  2171.5,       1025.8,     10.6999,  90.25
560,  2141.8999,    1019.4,     10.5,     90.0
451,  2125.8,       987.5,      10.5,     0.0
603,  2185.8,       987.5999,   10.6999,  180.5
477,  2171.5,       1006.5,     10.6,     270.0
507,  2394.3999,    987.0,      10.8,     0.0`

Now I want to mix row m_id with rest of rows. For example, value 426 (first) mix with 507 (last), but without changing x, y, z, a, only m_id. After the change it would look like

m_id,   x,          y,            z,      a
507, 2151.3999,    987.5999,   10.6,     0.0
426, 2394.3999,    987.0,      10.8,     0.0`

Order isn't matter, simply I want to mix data by random. I tried RAND function, but it isn't what I want.

SELECT * FROM vehicle_info ORDER BY m_id, RAND()




Aucun commentaire:

Enregistrer un commentaire