Hi queries experts!
I tried hard but I was unsuccessful…Here is my problem.
I log everyday in the journal the time sent as property and other fields for my projects under this model:
2025-04-27
[[my_project_A]]
time-spent:: 45
- some notes
and in the page of my_project_A there is tags:: #project
I would like to do a query which aggregates the sum of time spent by project and by month.
the result would be
month | project | time (in mins or hours)
2025-04 | project_A | 240
I tried different ways (thanks chatgpt) but it seems that tables render only block | page columns. I basically don’t know if we are limited in term of table output columns.
for example I tried the query below, but no “No Matched results” which I don’t get.
I feel I miss something in the query paradigm…Thanks a lot in advance and thanks again for the efforts you put into this great project! I really enjoy Logseq.
#+BEGIN_QUERY
{
:title "Monthly time spent on projects"
:query [
:find ?month ?projectname (sum ?ts)
:in $
:where
[$ ?pg :page/journal? true]
[$ ?pg :page/journal-day ?jd]
[(str ?jd) ?jds]
[(subs ?jds 0 6) ?month]
[$ ?b :block/page ?pg]
[$ ?b :block/properties ?prop]
[$ ?prop :block/property "time-spent"]
[$ ?prop :block/property-value ?ts]
[$ ?b :block/refs ?projectPage]
[$ ?projectPage :block/name ?projectname]
[$ ?projectPage :block/properties ?tprop]
[$ ?tprop :block/property "tags"]
[$ ?tprop :block/property-value "[[project]]"]
]
:view :table
}
#+END_QUERY