

{
"results": [
{
"time": "13:43:42"
},
{
"time": "13:43:43"
},
{
"time": "13:43:44"
},
{
"time": "13:43:44"
},
{
"time": "13:43:44"
},
{
"time": "13:44:9"
},
{
"time": "13:44:11"
},
{
"time": "13:45:28"
},
{
"time": "13:55:7"
},
{
"time": "13:55:7"
}
],
"success": true,
"meta": {
"duration": 0.6928119957447052,
"last_row_id": 0,
"changes": 0,
"served_by": "SinglePrimary-d8dc9de1-4b0a-4c65-xxxx-38d9a8ee8fda.db3",
"internal_stats": null
}
}SELECT DISTINCT time FROM … DISTINCT SELECT time FROM (SELECT time, count(*) as cnt FROM accesslog WHERE ip = ?1 GROUP BY time) WHERE cnt = 3 will give you want you want. Get a count of all occurrences of each time entry in a sub query and then filter for 3.wrangler.toml file
all() returns a D1Result objectconst { results } = await stmt.all(); to grab just the results property{
"results": [
{
"time": "13:43:42"
},
{
"time": "13:43:43"
},
{
"time": "13:43:44"
},
{
"time": "13:43:44"
},
{
"time": "13:43:44"
},
{
"time": "13:44:9"
},
{
"time": "13:44:11"
},
{
"time": "13:45:28"
},
{
"time": "13:55:7"
},
{
"time": "13:55:7"
}
],
"success": true,
"meta": {
"duration": 0.6928119957447052,
"last_row_id": 0,
"changes": 0,
"served_by": "SinglePrimary-d8dc9de1-4b0a-4c65-xxxx-38d9a8ee8fda.db3",
"internal_stats": null
}
}SELECT DISTINCT time FROM …DISTINCTSELECT time FROM (SELECT time, count(*) as cnt FROM accesslog WHERE ip = ?1 GROUP BY time) WHERE cnt = 3name = "foxes"
main = "src/index.js"
compatibility_date = "2023-05-18"
[[d1_databases]]
binding = "DB"
database_name = "foxes"
database_id = "im-not-sure-if-its-safe-to-share-it"all()const { results } = await stmt.all();export interface Env {
DB: D1Database;
}
export default {
async fetch(request: Request, env: Env) {
const stmt = env.DB.prepare('SELECT time FROM accesslog WHERE ip = ?1').bind("81.213.254.29");
const results = await stmt.all();
return Response.json(results);
},
};export interface Env {
DB: D1Database;
}
export default {
async fetch(request: Request, env: Env) {
const stmt = env.DB.prepare(`SELECT time FROM (SELECT time, count(*) as cnt FROM accesslog WHERE ip = ?1 GROUP BY time) WHERE cnt >= 3`).bind("81.213.254.29");
const results = await stmt.all();
return Response.json(results);
},
};const results = await stmt.all();
if (results.length > 0) {