I am by no means fluent in MYSQL. What I am trying to do is I have a table that has a list of Galleries with unique ID numbers. I have another table ImageData that has images that may be as many as 1000 that are related to each GalleryID that is in the first table. I want to do a select that will get 5 random records from each GalleryID. I am trying to do this without doing a loop and multiple hits to the database.
The tables are as follows Galleries -> GalleryID -> GalleryName
ImageData -> ImageID -> ImageName -> GalleryID
I hope this makes sense.