# Another samples

```sql
//select all entities within the bulk - the bulk_top (BIT) column is added to identify the top entity in a bulk
SELECT CAST(CASE WHEN EXISTS(SELECT * FROM EcASSOC WHERE EcENTITY.id=EcASSOC.ent_id_child) THEN 0 
ELSE 1 END AS BIT) AS bulk_top, * FROM EcENTITY WHERE bulk_id=@BulkId ORDER BY id DESC

//all association records EcASSOC joined with the child entity attributes (all bulk associations)
SELECT EcENTITY.*, EcASSOC.* FROM EcASSOC LEFT JOIN EcENTITY ON EcASSOC.ent_id_child=EcENTITY.id 
WHERE (EcENTITY.bulk_id=@BulkId)
```

{% hint style="danger" %} <mark style="color:red;">**Warning**</mark>

never update (change) the EcENTITY.comm\_dir value in the bulk! The whole bulk must have a single EcENTITY.comm\_dir value!
{% endhint %}


---

# 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://help.besmart.software/erpc/data-interface-reference-manual/exporting-data-from-a-vault/reading-data-from-data-interface/another-samples.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.
