Created
January 27, 2012 01:57
-
-
Save perusio/1686457 to your computer and use it in GitHub Desktop.
Drupal 7 DBTNG JOIN example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use a JOIN there are aliases. | |
$select = db_select('url_alias', 'a'); | |
$select->join('node', 'n', 'SUBSTR(a.source, 6) = n.nid'); | |
$pairs = $select->fields('a', array('source', 'alias')) | |
->orderBy('changed', 'DESC') | |
->condition('changed', $updated, '>=') | |
->execute() | |
->fetchAllKeyed(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment