This guys post has a nice explination of how to use the results from a select statement.

http://www.katcode.com/joomla-database-sql-queries/

Look at number 3.

I hope this helps someone else out there…