 <p>Would something like this work?</p> <pre><code>SELECT max(a.field_date_and_time_value2) as last_time , b.uid FROM field_data_field_date_and_time a INNER JOIN node b ON /* this piece might be wrong. what is the relationship between the first table and the second one? */ b.nid = '".$node-&gt;nid."' where a.field_date_and_time_value2 &gt; '".$today."' AND b.uid = $node-&gt;nid </code></pre>