Skip to main content
added 26 characters in body
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

Your version is very antiquated and insecure. For reference 8.2 was last supported in 2011. It was released in 2006. It lacks

  • tstz ranges
  • window functions
  • lateral joins

Moreover, we can't easily configure your setup to test our queries. Upgrade your version PostgreSQL; if you find that difficult to do, consider seeking out a consultant.

I think what you want is something like

SELECT member_id, t2.date, count(*)
FROM t AS t1
CROSS JOIN t AS t2
  ON ( member_id )
WHERE t1.date_date BETWEEN t2.date AND t2.date_date + '7 days
GROUP BY member_id, t2.date;date
HAVING count(*) >= 7;

But I can't test it and you didn't provide CREATE TABLE or INSERT statements.

Your version is very antiquated and insecure. For reference 8.2 was last supported in 2011. It was released in 2006. It lacks

  • tstz ranges
  • window functions
  • lateral joins

Moreover, we can't easily configure your setup to test our queries. Upgrade your version PostgreSQL; if you find that difficult to do, consider seeking out a consultant.

I think what you want is something like

SELECT member_id, t2.date, count(*)
FROM t AS t1
CROSS JOIN t AS t2
  ON ( member_id )
WHERE t1.date_date BETWEEN t2.date AND t2.date_date + '7 days
GROUP BY member_id, t2.date;

But I can't test it and you didn't provide CREATE TABLE or INSERT statements.

Your version is very antiquated and insecure. For reference 8.2 was last supported in 2011. It was released in 2006. It lacks

  • tstz ranges
  • window functions
  • lateral joins

Moreover, we can't easily configure your setup to test our queries. Upgrade your version PostgreSQL; if you find that difficult to do, consider seeking out a consultant.

I think what you want is something like

SELECT member_id, t2.date, count(*)
FROM t AS t1
CROSS JOIN t AS t2
  ON ( member_id )
WHERE t1.date_date BETWEEN t2.date AND t2.date_date + '7 days
GROUP BY member_id, t2.date
HAVING count(*) >= 7;

But I can't test it and you didn't provide CREATE TABLE or INSERT statements.

added 85 characters in body
Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

Your version is very antiquated and insecure. For reference 8.2 was last supported in 2011. It was released in 2006. It lacks

  • tstz ranges
  • window functions
  • lateral joins

Moreover, we can't easily configure your setup to test our queries. Upgrade your version PostgreSQL; if you find that difficult to do, consider seeking out a consultant.

I think what you want is something like

SELECT member_id, t2.date, count(*)
FROM t AS t1
CROSS JOIN t AS t2
  ON ( member_id )
WHERE t1.date_date BETWEEN t2.date AND t2.date_date + '7 days
GROUP BY member_id, t2.date;

But I can't test it and you didn't provide CREATE TABLE or INSERT statements.

Your version is very antiquated and insecure. For reference 8.2 was last supported in 2011. It was released in 2006. It lacks

  • tstz ranges
  • window functions
  • lateral joins

Moreover, we can't easily configure your setup to test our queries. Upgrade your version PostgreSQL; if you find that difficult to do, consider seeking out a consultant.

I think what you want is something like

SELECT member_id, t2.date, count(*)
FROM t AS t1
CROSS JOIN t AS t2
  ON ( member_id )
WHERE t1.date_date BETWEEN t2.date AND t2.date_date + '7 days
GROUP BY member_id, t2.date;

Your version is very antiquated and insecure. For reference 8.2 was last supported in 2011. It was released in 2006. It lacks

  • tstz ranges
  • window functions
  • lateral joins

Moreover, we can't easily configure your setup to test our queries. Upgrade your version PostgreSQL; if you find that difficult to do, consider seeking out a consultant.

I think what you want is something like

SELECT member_id, t2.date, count(*)
FROM t AS t1
CROSS JOIN t AS t2
  ON ( member_id )
WHERE t1.date_date BETWEEN t2.date AND t2.date_date + '7 days
GROUP BY member_id, t2.date;

But I can't test it and you didn't provide CREATE TABLE or INSERT statements.

Source Link
Evan Carroll
  • 64.7k
  • 49
  • 251
  • 496

Your version is very antiquated and insecure. For reference 8.2 was last supported in 2011. It was released in 2006. It lacks

  • tstz ranges
  • window functions
  • lateral joins

Moreover, we can't easily configure your setup to test our queries. Upgrade your version PostgreSQL; if you find that difficult to do, consider seeking out a consultant.

I think what you want is something like

SELECT member_id, t2.date, count(*)
FROM t AS t1
CROSS JOIN t AS t2
  ON ( member_id )
WHERE t1.date_date BETWEEN t2.date AND t2.date_date + '7 days
GROUP BY member_id, t2.date;