Popular recipes tagged "foreign"http://code.activestate.com/recipes/tags/foreign/2011-06-11T02:43:22-07:00ActiveState Code RecipesConjunction select using foreign keys (Text) 2011-06-11T02:43:22-07:00Kaushik Ghosehttp://code.activestate.com/recipes/users/4166965/http://code.activestate.com/recipes/577747-conjunction-select-using-foreign-keys/ <p style="color: grey"> Text recipe 577747 by <a href="/recipes/users/4166965/">Kaushik Ghose</a> (<a href="/recipes/tags/conjunction/">conjunction</a>, <a href="/recipes/tags/foreign/">foreign</a>, <a href="/recipes/tags/key/">key</a>, <a href="/recipes/tags/select/">select</a>, <a href="/recipes/tags/sql/">sql</a>). </p> <p>Say we have a table (notes) containing rows we want to select. Each note has one or more keywords (stored in a table of the same name). We want to select notes that have a conjunction of keywords (AND). notes and keywords are linked through a foreign key table notes_keywords. The following SQL statement allows us to do this</p>