# VTScada REST SQL Query Result Combination into one single row

**URL:** <https://forum.vtscada.com/t/vtscada-rest-sql-query-result-combination-into-one-single-row/1071>\
**Category:** Support Forums\
**Created:** [June 21, 2026, 2:12am UTC](https://forum.vtscada.com/t/vtscada-rest-sql-query-result-combination-into-one-single-row/1071 "2026-06-21T02:12:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![John003478](https://forum.vtscada.com/user_avatar/forum.vtscada.com/john003478/32/1071_2.png) [@John003478](https://forum.vtscada.com/u/John003478)\
**Post date:** [June 21, 2026, 2:12am UTC](https://forum.vtscada.com/t/vtscada-rest-sql-query-result-combination-into-one-single-row/1071/1 "2026-06-21T02:12:18Z")

</div>

We currently testing the VTScada REST SQL Query function against historian data.

We are querying two tags:

MORESCO-1\CalcTags\Lumbo\LumF1\SustainedUnsched\Cust-Min:Value  
MORESCO-1\CalcTags\Lumbo\LumF1\SustainedUnsched\Cust-Aff:Value

using the following SQL query:

SELECT timestamp,  
‘MORESCO-1\CalcTags\Lumbo\LumF1\SustainedUnsched\Cust-Min:Value’ AS CustMin,  
‘MORESCO-1\CalcTags\Lumbo\LumF1\SustainedUnsched\Cust-Aff:Value’ AS CustAff  
FROM History  
WHERE timestamp BETWEEN ‘2026-05-28’ AND ‘2026-06-27’  
ORDER BY timestamp ASCENDING

The query result returns separate historian records for each tag. Since the two tag updates occur approximately 1 ms apart and timestamp different, VTScada stores them as individual historian events, resulting in output similar to attached query result.

![Query Result.jpg](https://forum.vtscada.com/uploads/default/original/1X/56cc2ea6ff4263c0e2b61629e3ad58ecf1f4ad63.jpeg)  
 ![JSON Query Test.jpg](https://forum.vtscada.com/uploads/default/original/1X/faab5c84ea18a6d24c9f481bd9dec29f0b9cc336.jpeg)

We would like to know whether can we combine or there is a method to combine these into a single record like below? Could you please guide me how to do?

![Desired reuslt (one row only).PNG](https://forum.vtscada.com/uploads/default/original/1X/dc4876e841e4fda528dec211a0c1c541cfef731b.png)
