A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

MySQL JOIN syntax

(remember the brackets):

SELECT COUNT(*) FROM search_fact JOIN (date_dm) USING (date_id) WHERE day = 22 AND month = 4 AND year = 2008;

or equivalently:

SELECT COUNT(*) from search_fact, date_dm WHERE search_fact.date_id = date_dm.date_id AND day = 22 AND month = 4 AND year = 2008;

Select all the search_fact rows that have a date_id that corresponds to 22/04/2008.