mercredi 30 mars 2016

How do I select values from a table between the current date and a fixed date each year?

In my program I have a table that holds details about jobs entered and the amount earned from them. I want to be able to select the amounts from jobs whose DATEBANK lies between the current date and a fixed date each year: The start of the financial year.

c.execute("SELECT AMOUNT FROM vatsum1 WHERE DATEBANK BETWEEN '{x}' AND '{y}'".\
                    format(y = DateBankCur, x = StrtFYear))    

I have managed to get the current date fine and the start of financial year for a specific year (e.g 01/02/2016) but this won't hold up when I am using dates from later or previous years. How can I pick the most recent "01/02" to compare the current date to?

Aucun commentaire:

Enregistrer un commentaire