With SQL reports all data of the LDB is available to you. This is a powerful tool to output all data in the desired form. Therefore, the basics are taught in the form of training to unlock this function.
1. Basic Building Block
A SQL report consists of an SQL code with the following content:
**SELECT**
samples.name **AS** 'Sample',
samples.description **AS** 'Description'
**FROM** samples
**WHERE** samples.visible_to != 'deleted'
**ORDER BY** samples.name DESC;
2. Elements
The following elements are commonly used:
SELECT: ColumnsAS: Column-Description (optional)FROM: Data source tableWHERE: ConditionsORDER BY: Sorting
3. Query Building Blocks
You can use the following query building blocks in your SQL reports:
WHERE samples.visible_to != 'deleted' Excludes deleted samples.
WHERE samples.date BETWEEN _FROMDATE_ AND _TILLDATE_ Allows the entire evaluation to be filtered by date ranges (LDB internal variable, see instructions on Variables in query reports). The filter is displayed above the SQL Report.

ORDER BY samples.date DESC Sorts in descending (DESC) order by sample date (or ASC for ascending).
For more examples of evaluations, refer to: Evaluations -> Examples
4. JOIN
To join multiple tables together, you need a JOIN.
SELECT FROM oldTabs
…
JOIN newTabs ON ordTabs.id = newTabs.ordTab_id;
Note: In the LAB DATABASE, all table names are in plural (Tables), while column names are mostly in singular (Table). This makes it easier to distinguish between table names and column names.
Here is a small overview of which tables are linked for the areas: Order-Sample-Result-Parameter-Specification.

5. Link
To obtain links in the result table, use the laboratory database's internal linking system. For example, to link to the sample details view, use:
CONCAT('link==../samples/view/', samples.id, '==', samples.name) as 'Samples'../samples/view/' = LDB-internal Linksamples.id=Part of the linksamples.name = Display value'Proben' =Column header
6. Linked Master Data Fields
For example, if a master data field in samples (DDF_CUSTOMER) is linked to customer numbers, use the following SELECT/JOIN:
customers.name as 'customer'
FROM samples
JOIN customers ON samples.DDF_KUNDE = customers.id
7. Functions
| Example | Result | Remark | |
|---|---|---|---|
| IF-Then(CASE) | ```sql SELECT CASE WHEN MyField = 0 | ||
| THEN 'is 0' ELSE 'not 0' END | |||
| AS 'Result' | |||
| FROM myTable;``` | IF MyField = 0 then result = 'Is Null' else result = 'Not 0' | ELSE ist optional | |
| IF-Then (IF) | ```sql IF (MyField = 0,'is 0', 'not 0') | ||
| AS 'Result' | |||
| FROM MyTable;``` | IF MyField = 0 then Result = 'is 0' else Result = 'not 0' | ||
| Decimal Number format | sql CAST(REPLACE(parameters.value0, ',', '.') AS DECIMAL(12,2)) |
1.05 -> 1,05\n100.2312 -> 100,23 | replaces the comma with a dot and creates with CAST … as DECIMAL(12,2) a decimal number. 12= Total number of digits, 2 = Number of digits after decimal point |
Laatste wijziging: 21.08.2026
Algemeen
Leveranciersbeoordeling
Materiaal
Medewerkers
Klanten
Opdrachten
Monsters
PDF-sjablonen
Bijlagen
Recepten
Verslagen
Editor voor rapporttabellen
Interfaces
Kompetenzen
AI-functies
Inleidende fase
Analyses
Sjablonen
Klantenportaal (optioneel)
Aanbiedingen
Facturen
Parameters
Rekenwerk met parameters
Webservices
Transformatiecode
Controleplannen / Grenswaarden / Specificaties
Documentbeheer
Vragen en antwoorden
Testmiddelen
Opleidingen voor medewerkers
8D-rapport
Overige
Bestandsbeheer
Processen