MySQL group by day, month or year using a timestamp column

  In Ruby on Rails, created_at and updated_at columns are MySQL timestamp columns.  GROUP BY is pretty useless on a timestamp column, unless you are trying to group rows that were added at the same second.  I needed to group by just the date, so in order to do this I had to manipulate the …

Translate characters or replace substrings

Is there any function which replaces params in a string? Something like this:? Code: $format_str = "My name is %name."; /* this was set in a                                       configuration file – config.php */$str = xprintf($format_str, array(\’name\’ => \’Joe\’, \’age\’ => 150));               /* above is somewhere in main code */ The expected value of $str after …