[ticket/261] Properly build birthday list database query

This should fix compatibility with sqlite3.

B3P-261