in reply to Not able to find dateTime value using sql
- Run your SQL against the database, removing Perl (or whatever) from the equation. If the result isn't what you want, your SQL is most likely wrong, less likely is that there's a bug in the database product(s) you use.
- If the SQL works as expected then examine how you manipulate the results afterwards. Basic print statements, before and after manipulation will help.
- Debugging and Optimization from tutorials
Also, consider using DBI to interact with databases.