Using GROUP BY and RAND()

This is a discussion on Using GROUP BY and RAND() within the MySQL Database forums, part of the Database Forums category; Hi people :) I'm having a problem with a request using ORDER BY RAND() and GROUP BY : SELECT a.id_a, ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-03-2006
Takusen
 
Posts: n/a
Default Using GROUP BY and RAND()

Hi people :)

I'm having a problem with a request using ORDER BY RAND() and GROUP BY
:

SELECT a.id_a, b.id_b
FROM table_A a, table_B b
GROUP BY a.id_a
ORDER BY RAND()

The result I'd like to get would be a table with all my distincts
"id_a" from "table_A", associated, each one, with a random value of
"id_b" contained in my table "Table_B"

I apologize for my english :).

If you have an idea ... thanks :)

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:20 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0