MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
April
Sun Mon Tue Wed Thu Fri Sat
           
7
           
2017
Months
Apr


Fri, Apr 07, 2017 3:14 pm

Counting SQLite records based on a specified date

I track work requests in an SQlite database. For each request in a table named "Tasks" in the database, there is a column holding the date the request was approved. Every week I need to include the number of requests approved that week in a weekly report. I can do that with the Structured Query Language (SQL) command SELECT COUNT(*) FROM Tasks WHERE Approved >= date(CURRENT_DATE,"-7 day"). I have a Python script that queries the SQL database to count the requests approved within the last week, but sometimes I want to determine the number of requests approved since a particular date. So I modified the script to accept a date provided as an argument on the command line and, if a date is specified, to determine the number of entries where the approval date matches the specified date or is later than the specified date.

[ More Info ]

[/languages/python] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo