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.<br>Check this for chaining - <a href="http://drupal.org/node/1060924">http://drupal.org/node/1060924</a>.<br>

<br>You can use this query like this<br><div>$query = db_select(&#39;user_badges_roles&#39;, &#39;ubr&#39;)</div><div>  -&gt;fields(&#39;ubr&#39;, array(&#39;rid&#39;, &#39;ubb&#39;))</div>
<div>  -&gt;join(&#39;user_badges_badges&#39;, &#39;ubb&#39;, &#39;ubb.bid = ubr.bid&#39;);<br><br>$query = condition(&#39;ubr.rid&#39;, &#39;@todo Set the appropriate argument.&#39;)</div><div>  -&gt;execute();</div><br>

Try this, and you might get some success<br><br><div class="gmail_quote">On Tue, Oct 11, 2011 at 10:45 PM, Ms. Nancy Wichmann <span dir="ltr">&lt;<a href="mailto:nan_wich@bellsouth.net">nan_wich@bellsouth.net</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="color:#000;background-color:#fff;font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt">

<div style="font-family:arial,helvetica,sans-serif"><span>Same as Boobatower&#39;s. Not working for me.<br></span></div><div class="im"><div style="font-family:arial,helvetica,sans-serif"> </div><div><font size="4" color="#ff007f" face="bookman old style, new york, times, serif"><i><b>Nancy</b></i></font></div>

 <div><font face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</font></div></div><div><br><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px">

<div style="font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:12pt"><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold">From:</span></b> sivaji j.g &lt;<a href="mailto:sivaji2009@gmail.com" target="_blank">sivaji2009@gmail.com</a>&gt;<br>

<b><span style="font-weight:bold">To:</span></b> <a href="mailto:support@drupal.org" target="_blank">support@drupal.org</a>; Ms. Nancy Wichmann &lt;<a href="mailto:nan_wich@bellsouth.net" target="_blank">nan_wich@bellsouth.net</a>&gt;<br>

<b><span style="font-weight:bold">Sent:</span></b> Tuesday, October 11, 2011 1:05 PM<br><b><span style="font-weight:bold">Subject:</span></b> Re: [support] Converting a query to D7<br></font><div class="im"><br>
On Tue, Oct 11, 2011 at 9:05 PM, Ms. Nancy Wichmann<br>&lt;<a href="mailto:nan_wich@bellsouth.net" target="_blank">nan_wich@bellsouth.net</a>&gt; wrote:<br>&gt; Before I pull any more hair out, can someone properly convert this to a D7<br>

&gt; select query, please:<br>&gt; SELECT ubr.rid, ubb.* FROM {user_badges_roles} ubr INNER JOIN<br>&gt; {user_badges_badges} ubb ON ubb.bid = ubr.bid WHERE ubr.rid = %d<br><br>I use this online service <a href="http://jonduell.com/sql-parser" target="_blank">http://jonduell.com/sql-parser</a>. It always<br>

worked good for my needs.<br></div></div></div></blockquote></div></div></div><br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Vaibhav Jain<br>