MySQL

Custom tables and their queries

Sometimes we need to put data in a custom table in drupal. Usually when this happens we also need to do some fancy queries on these tables.
The db_select function is usually the starting point here, and with methods like join() and condition() and fields() we are able to fetch most of the data.
 

The other day I needed to get data that was between certain dates. Here is what I did: