Category Archives: sql

Selecting data in a specific date range

Sometimes, you have to return all objects created in a specific date range, e.g. you want to return all posts created in the last thirty days. Thanks to the nice functions for date operations provided by MySQL this task is simple: $this->Post->findAll( ‘WHERE Post.created >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)’);

New syntax for conditions

RC5 is still warm, but the development goes on ;-) And so a new syntax has been added for conditions. With “–return” you can avoid that your condition is quoted. Example: $this->User->findAll(‘–return User.company_id = 1’); That generates something like … WHERE User.company_id = 1 … That feature is useful if you have complex conditions you […]

SQL-Script for dropping dbAcl tables

Maybe this short SQL script is also useful for someone other: DROP TABLE IF EXISTS acos; DROP TABLE IF EXISTS aros; DROP TABLE IF EXISTS aros_acos; DROP TABLE IF EXISTS aco_actions;