I am trying to implement system-wide login control and I need to calculate the average daily number of failed login attempts in the last 3 months.
I am currently inserting a record for every login failure, each with a timestamp. How can I do this in MySQL?
Thanks in advance for your help.
SELECT AVG(cnt) FROM (SELECT COUNT(*) AS cnt FROM mytable WHERE `date` BETWEEN DATE_SUB(NOW(), INTERVAL 3 MONTH) AND NOW() GROUP BY DATE(`date`)) x
Assuming you have a table mytablewith a datetype field date, datetimeortimestamp
mytable
date
datetime
timestamp
Source: https://habr.com/ru/post/1792937/More articles:JSP can not find bean Class using modifiers "" - javaA neat way to set the position of my object in linq collections - c #coldfusion + xml get node according to date - coldfusionhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1792935/how-to-implement-repository-pattern-for-multiple-database&usg=ALkJrhgD-I1H8qeWV_ZLkcyHOAtdE-OhMQSSRS Chart - Showing Symbols and Percentages - chartsΠΠ°ΠΊ ΠΌΡ ΠΌΠΎΠΆΠ΅ΠΌ ΡΠ΄Π°Π»ΠΈΡΡ ΠΎΠ±ΡΠ΅ΠΊΡ (ΠΈΠΌΠ΅ΡΡΠΈΠΉ ΡΠ΅Π»ΠΎΡΠΈΡΠ»Π΅Π½Π½ΡΠΉ ΠΈΠ΄Π΅Π½ΡΠΈΡΠΈΠΊΠ°ΡΠΎΡ)? - rubyPHP shell_exec () - problems running the command - phpHow to assign values ββusing name_fields with has_many association in rails 3 - ruby-on-railsline break on regular expressions - javascript"Undefined ΡΠΈΠΌΠ²ΠΎΠ» <ΡΡΠ½ΠΊΡΠΈΡ> ΠΏΠ΅ΡΠ²Π°Ρ ΡΡΡΠ»ΠΊΠ° Π² ΡΠ°ΠΉΠ»Π΅ <ΡΠ°ΠΉΠ»>" ΡΡΡΠ»ΠΊΠ° ΠΎΡΠΈΠ±ΠΊΠ° - cAll Articles