I have a table that has a datetime column and I need to retrieve records with a date within the previous hour, day, week, month etc.
One constraint is that I need to support Oracle, MySQL, DB2 and SQL SERVER. Can I achieve this with one SQL query only?
Since they all can handle datetimes differently, I’m going to guess you can’t. You might be able to separate out the platform-specific stuff and swap it when the platform changes.
If you tell us more about this problem, we might be able to suggest something in more detail.