Nancy, I believe this can be because of some functions that cannot be chained, join is one of them, and that might be the reason you are facing issues.
Check this for chaining - http://drupal.org/node/1060924.

You can use this query like this
$query = db_select('user_badges_roles', 'ubr')
  ->fields('ubr', array('rid', 'ubb'))
  ->join('user_badges_badges', 'ubb', 'ubb.bid = ubr.bid');

$query = condition('ubr.rid', '@todo Set the appropriate argument.')
  ->execute();

Try this, and you might get some success

On Tue, Oct 11, 2011 at 10:45 PM, Ms. Nancy Wichmann <nan_wich@bellsouth.net> wrote:
Same as Boobatower's. Not working for me.
 
Nancy
 
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.


From: sivaji j.g <sivaji2009@gmail.com>
To: support@drupal.org; Ms. Nancy Wichmann <nan_wich@bellsouth.net>
Sent: Tuesday, October 11, 2011 1:05 PM
Subject: Re: [support] Converting a query to D7

On Tue, Oct 11, 2011 at 9:05 PM, Ms. Nancy Wichmann
<nan_wich@bellsouth.net> wrote:
> Before I pull any more hair out, can someone properly convert this to a D7
> select query, please:
> SELECT ubr.rid, ubb.* FROM {user_badges_roles} ubr INNER JOIN
> {user_badges_badges} ubb ON ubb.bid = ubr.bid WHERE ubr.rid = %d

I use this online service http://jonduell.com/sql-parser. It always
worked good for my needs.

--
[ Drupal support list | http://lists.drupal.org/ ]



--
Regards,
Vaibhav Jain