SQL: Subselect

Enquiry in own or foreign database

Properties

User interface

Field in show mode

[INSERT IMAGE]

Due to its nature this field has no special editing mode.

Configuration

image.png

Required:

Options:

Notes for usage:

Configuration example 1

Solution setup

Solution "Child items" (system name: "testchild")
* Relation field "owner" (system name: "PARENT").

Solution: "Parent items" (system name: "testparent")
* Date field "starting date" (system name: "DATO")

Business requirement

Display the starting date (system name: "DATO") from the related parent table, linked by the local field owner (system name: "PARENT").

Subselect SQL statement

SELECT DATO 
FROM data_testparent 
WHERE :PARENT = data_testparent.DataID

this is the shorthand version for

...
WHERE data_testchild.PARENT = data_testparent.DataID

Configuration example 2

Solution setup

Solution "Example" (system name: "example")
* Status log activated

Business requirement

Display the number of state changes for a data item

Subselect SQL statement

SELECT CONCAT( COUNT(*), ' transitions') 
FROM data_example_statuslog 
WHERE data_example_statuslog.DataID = :DataID

this is the shorthand version for

...
WHERE data_example_statuslog.DataID = data_example.DataID

Developer info


Revision #2
Created 28 March 2025 14:56:13 by Theis Villumsen
Updated 28 July 2025 13:43:26 by Theis Villumsen