I would like to delete all rows from the database that is older than 1 month. How can I do that in Drupal 8?
DELETE FROM myTable WHERE MyColumn < DATEADD(MONTH, -1, GETDATE())
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityYou can do it by using this code
$query = \Drupal::database()->delete('table');
$query->condition('some column', 'some condition');
$query->execute();