Zk | Hmf.

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