Support forumHow cani get the hole Appointments via sql?
Tom asked 2 years ago

Hi,
unfortunately the register function don’t send mail to me, also here a new question 
I use for covid documentation the booking system for our sport club. 
I have to send every day  the bookings to government . I will this don’t do manually 🙂 – i’m not home any day to do this …. not other can do this… unfortunately :(.
What is the sql -statement to get the whole appointments with name, email etc.?
I think, i will write a script for a cronjob and extract the data direct from the database.
I hope that can work. Thx for your work… 
PS: Other solutions also fine :). 
—-
That’s the answers before – THX for that – helps a lot.
 

DELETE FROM wp_ea_fields WHERE app_id IN (SELECT id FROM wp_ea_appointments where `date` < now() – interval 30 DAY);
DELETE FROM wp_ea_appointments where `date` < now() – interval 30 DAY;

but I would suggest that you first have a dry run by replacing DELETE FROM with SELECT * FROM just to see results.
Also one more thing all user related Appointments data (those one from fields are stored inside fields table) so maybe replacing those values with empty values could be better solution. If you want to track money flow or have some global stats that don’t expose particular user data 🙂

1 Answers
Nikola Loncar Staff answered 2 years ago

Hi Tom, you can also use Export to CSV. Maybe event to use script to call that report with time frame. 🙂

Best regards,
Nikola