3 ms·
Learn SQL beyond simple statements. For instance, did you know that you can write this in SQL: "SELECT * FROM marketing_promotions WHERE 201205 BETWEEN month_fr
by Toshio 14y ago
Learn SQL beyond simple statements. For instance, did you know that you can write this in SQL: "SELECT * FROM marketing_promotions WHERE 201205 BETWEEN month_from AND month_to" ? There are a lot of interesting things you can do with SQL which Rails isn't necessarily provide a good API into. For instance, did you know that you can create a custom crafted join view at the database level, with a sophisticated where clause, then instruct ActiveRecord to treat it as a real table? (This by the way sounds like what you need to do for your particular problem.) Also have a look into SQL subqueries, they are a very powerful tool.
- rman666 14y agoThank you Toshio!