Sample Header Ad - 728x90

Use of MySQL trigger to insert row's week number

0 votes
1 answer
454 views
I have a table of orders in a MariaDB database that currently has a datetime column. For the dashboard I am building for this database, I have a statistic I would like to display which is "Orders This Week." My question is this: Can a trigger be used to take the datetime from a just-inserted order and insert the week number of that date into another column? If so, can I also use SQLAlchemy to match the order's week number to Python's strftime('%U') to see orders in a given week?
Asked by smallpants (101 rep)
Mar 30, 2017, 03:57 PM
Last activity: Mar 16, 2022, 06:01 PM