# Datev Export sqlGetCounter  Example

### Available Parameters

1. @company - If you work with multiple companies, you have to export each company by it's own.
2. @dateFrom - Start date for the export
3. @dateUntil - End date for the export

### Example Usages

```sql
 SELECT MAX(DatevExportId) FROM
 (
    SELECT ISNULL(MAX(cordDatevExportId), 0) AS DatevExportId FROM customerOrder WHERE cordCompanyId = @company
    UNION ALL
    SELECT ISNULL(MAX(sordDatevExportId), 0) AS DatevExportId FROM supplierOrder  WHERE sordCompanyId = @company
 ) AS sub
```
