Skip to main content

max / makenotwork

1.2 KB · 41 lines History Blame Raw
1 {
2 "db_name": "PostgreSQL",
3 "query": "\n SELECT p.id AS \"id: ProjectId\", p.title,\n t.currency AS \"currency!: SettlementCurrency\",\n COALESCE(SUM(t.amount_cents), 0)::BIGINT AS \"revenue!\"\n FROM projects p\n JOIN items i ON i.project_id = p.id\n JOIN transactions t ON t.item_id = i.id AND t.status = 'completed'\n WHERE p.user_id = $1\n GROUP BY p.id, p.title, t.currency\n HAVING COALESCE(SUM(t.amount_cents), 0) > 0\n ORDER BY COALESCE(SUM(t.amount_cents), 0) DESC\n ",
4 "describe": {
5 "columns": [
6 {
7 "ordinal": 0,
8 "name": "id: ProjectId",
9 "type_info": "Uuid"
10 },
11 {
12 "ordinal": 1,
13 "name": "title",
14 "type_info": "Varchar"
15 },
16 {
17 "ordinal": 2,
18 "name": "currency!: SettlementCurrency",
19 "type_info": "Varchar"
20 },
21 {
22 "ordinal": 3,
23 "name": "revenue!",
24 "type_info": "Int8"
25 }
26 ],
27 "parameters": {
28 "Left": [
29 "Uuid"
30 ]
31 },
32 "nullable": [
33 false,
34 false,
35 false,
36 null
37 ]
38 },
39 "hash": "f65e97830cce478bc9fb0259f9b2291c9d99ec63a182190291b6e66bd898384d"
40 }
41