I
I
ILoveYAnny2016-04-20 14:01:21
PHP
ILoveYAnny, 2016-04-20 14:01:21

How to allow only 10 records per day in PostgreSQL?

Hello, I'm interested in the question, with a certain action, I save the user's IP in the database, I need to make a daily limit. That is, 10 actions (and records in the database) per day, how can this be done? I had a command for MySQL, but it didn't work :(

SELECT COUNT(*) FROM `votes_log` WHERE date > DATE_SUB(NOW(), INTERVAL 3 DAY) AND user_id=?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Niomin, 2016-04-20
@ILoveYAnny

SELECT COUNT(*) FROM `votes_log` WHERE date > NOW() - INTERVAL '3 DAY' AND user_id=?

If I understand the question correctly, this should work. Only here not a day, but three days. That's how it should be, right?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question