Hi,
My first tought is to use the where clause. You can add any valid SQL where clause, would a sub query be an alternative?
How do you know the number of days for an event? Is it somewhere stored? Or calculated?
Best regards,
Peter
I have a column (integer) that represents the number of days prior to schedule date to “open” the event for registration. The value can vary (e.g. 30 days for some events, and 45 for others).
Thus the why the “where” clause would not work easily.
I am new to WP and SQL. It seems I could right a SQL function and run that everyday to update the Status column to either “Open” or “Close”. Would that work?
Can you share your datamodel? You can use the contactform on the plugin website if you prefer to send it in private.
Thanks,
Peter
So, I have learned some of the basic SQL syntax and can perform what I want to do fairly easily. My task was to update a column in a table to have an “Open” or “Closed” status based on the event date and the current date. I want to “Open” the event to registration some number of days (e.g. 45) before the actual event date and “Close” Registration some number of days (e.g. 7) before the actual event date. I added columns to represent the open and close timeframes, and then used the SQL update command to update the status. Saved this as a procedure with a trigger to run even day.
I then can use the WHERE clause to filter only the OPEN events.
Sorry to bother you with a trivial matter.
Unless, of course, there is a better way. I am open to suggestions.
I am closing this thread.
Looks like you found a solution! 👍
I wonder, though, if you need a status and an update. If you have a start and end data, you should be able to select actual events and add a subquery to your where clause. If you want to I can have a look it, but I need to have a look at your datamodel. If you’re fine with your solution, it’s okay of course.
Best regards,
Peter