%title Hmf.
%date 2007-05-24 18:41:25
:diary:livejournal:fossils:

Never used <code>JOIN</code>s before, so can someone tell me if I'm doing this right?

<code>SELECT wcmsVertices.*, wcmsDiffs.modifer, wcmsDiffs.mtime, wcmsDiffs.reason FROM wcmsVertices RIGHT JOIN wcmsDiffs USING (id) WHERE wcmsVerticies.id = '$vertex' ORDER BY wcmsDiffs DESC LIMIT 1;</code>

I want to select everything from wcmsVertices and the three specified fields from wcmsDiffs where the 'id' fields are both equal to $vertex.  If there's more than one Diff, though, I want to only grab the most recent one.