List:General Discussion« Previous MessageNext Message »
From:Chris Knipe Date:December 3 2003 10:34pm
Subject:sub query format...
View as plain text  
Lo all,

What's the format for a sub query in MySQL??

I've tried the below with a few variants but I can't seem to get it
sorted...

SELECT songlist.ID AS ID,
       songlist.duration AS Duration,
       songlist.artist AS Artist,
       songlist.title AS Title,
       songlist.filename AS FileName
  FROM songlist
  LEFT JOIN categorylist ON songlist.ID=categorylist.songID
 WHERE categorylist.categoryID=(SELECT category.ID FROM category WHERE
category.parentID='4' ORDER BY RAND() LIMIT 1)
 ORDER BY songlist.filename;

This is a InnoDB Table, running on 4.0.14...

Thanks,
me


Thread
sub query format...Chris Knipe3 Dec
  • Re: sub query format...Daniel Kasak3 Dec