# Summing up

{% hint style="success" %}
Run this example using its test data from within [FlightPath Data](https://www.flightpathdata.com/).
{% endhint %}

```
~
   This csvpath sums up two header values in a similar way to this SQL.
	SELECT
	  SUM (CASE
	    WHEN neighborhood IN ('Roxbury','South Boston')
	    THEN worker_hours_this_period
	    ELSE 0 END) AS roxbury_south_boston_hours,
	  SUM (CASE
	    WHEN trade IN ('Iron Worker','Pipefitter')
	    THEN worker_hours_this_period
	    ELSE 0 END) AS iron_worker_pipefitter_hours
	FROM projects

   id: hello world
   test-data: examples/counting/projects.csv
~
$[1*][
	subtotal.neighborhood(#neighborhood, #worker_hours_this_period)
	subtotal.trade(#trade, #worker_hours_this_period)

	@trade_hours = add( get("neighborhood", "Roxbury"), get("neighborhood", "South Boston") )
	@neighborhood_hours = add( get("trade", "Iron Worker"), get("trade", "Pipefitter") )

	last() -> replace( #neighborhood, @neighborhood_hours )
	last() -> replace( #trade, @trade_hours )
	last() -> collect( "neighborhood", "trade" )
	last() -> print("Check out the matches tab")
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.csvpath.org/getting-started/the-flightpath-data-examples/counting/summing-up.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
