How to write custom SQL to query upcoming events, site notifications and site messages?

How to write custom SQL to query upcoming events, site notifications and site messages?

par wz z,
Nombre de réponses : 3

Thank you very much! I investigated into the mdl_notificatoins, mdl_message tables, they seems have more content than I want. I just want those displayed in webpage rather than in emails.

And there is no such a table for upcoming events.  So please help me ~

Moyenne des évaluations  -
En réponse à wz z

Re: How to write custom SQL to query upcoming events, site notifications and site messages?

par Dominique Palumbo,
Avatar Particularly helpful Moodlers Avatar Plugin developers
Hi,

You've already a block that do that for upcoming events.
You'll find all the code you need.
\blocks\calendar_upcoming

For the table is mdl_event

SELECT * from mdl_event WHERE timestart > extract(epoch from now()) -- for pgsql
SELECT * from mdl_event WHERE timestart > unix_timestamp(now()) -- for mysql

Hope it's helped.

Dominique.
Moyenne des évaluations Useful (2)
En réponse à Dominique Palumbo

Re: How to write custom SQL to query upcoming events, site notifications and site messages?

par wz z,
Thank you very much!
En réponse à wz z

Re: How to write custom SQL to query upcoming events, site notifications and site messages?

par Taranveer Singh,
  • Click in the SQL Query area and type your SQL command. Optionally, double-click on a table name or field from the field list to include it in your query at the cursor location.
  • Click Run to run the query against your database. View the results in the Results area.
  • SQL Runner will load up to 5000 rows of the query’s result set.
  • For SQL dialects that support streaming, you can download the set from the sql server to access the full report.