drupal 7 db delete node programmatically based on condition code example
Example: drupal 7 db delete node programmatically based on condition
<?php
// Drupal 7
$nid = 5;
$num_deleted = db_delete('node')
->condition('nid', $nid)
->execute();
// Above example is equivalent to the following in Drupal 6
$nid = 5;
db_query("DELETE FROM {node} WHERE nid = %d", $nid);
?>