zk/diary/2007-05-24-18:41:25.md

587 B

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

Never used JOINs before, so can someone tell me if I'm doing this right?

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;

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.