[thelist] MySQL: SELECT DISTINCT ... ORDER BY RAND() bug?

Hassan Schroeder hassan at webtuitive.com
Wed Sep 17 08:22:37 CDT 2003


Jay Blanchard wrote (re' problem with):

>>    SELECT DISTINCT  ....  ORDER BY RAND()

> I don't have another database (other than MySQL) handy, but I do have
> 3.23.33, 3.23.47, 3.23.49, 4.0.13 and I tested the above query on all
> and got not problems with the results from the command line. What table
> type are you using (mine are all ISAM)?

Mine are MyISAM, but I just changed them, and no difference.

Were you using two tables with a one-to-many relationship of the
joining field? As in

    table 1                  table 2
prodID (p/k)           prodID  inventoryID (p/k)
    100001              100001       1
    100002   ----+-->   100002       2
    100003       +-->   100002       3
    100004       +-->   100002       4

TIA,
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the thelist mailing list