Query results incorrect with temp tables

I have 2 temp table statements.
They insert an identical datastructure, only with different data because of the difference in dates.
However, when I run the query metabase presents me with wildly different data.

When tracing the query, the server gives the correct data back, but metabase doesn't show it.

The structure is like the following:
INSERT INTO TEMP1

INSERT INTO TEMP2

SELECT X
LEFT JOIN TEMP1
LEFT JOIN TEMP2.

When copying and running the query from BOTH the preview and what the SQL SERVER server traces, correct results are shown.
image

This issue has completely confounded me. I have cache turned off and I have also cleared mariadb query cache.

Diagnostic info:{ "browser-info": { "language": "en-US", "platform": "Win32", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0", "vendor": "" }, "system-info": { "file.encoding": "Cp1252", "java.runtime.name": "OpenJDK Runtime Environment", "java.runtime.version": "17.0.6+10", "java.vendor": "Eclipse Adoptium", "java.vendor.url": "https://adoptium.net/", "java.version": "17.0.6", "java.vm.name": "OpenJDK 64-Bit Server VM", "java.vm.version": "17.0.6+10", "os.name": "Windows Server 2019", "os.version": "10.0", "user.language": "en", "user.timezone": "Europe/Berlin" }, "metabase-info": { "databases": [ "h2", "sqlserver" ], "hosting-env": "unknown", "application-database": "mysql", "application-database-details": { "database": { "name": "MariaDB", "version": "10.11.2-MariaDB" }, "jdbc-driver": { "name": "MariaDB Connector/J", "version": "2.7.6" } }, "run-mode": "prod", "version": { "date": "2023-04-28", "tag": "v0.46.2", "branch": "release-x.46.x", "hash": "8967c94" }, "settings": { "report-timezone": "Europe/Amsterdam" } } }

You need to set the rowcount override on the database in Metabase to 0 which means no limit, or something that makes more sense. The default row count is 2000, which is what you get if you add up your results per column.

Yep. I actually solved this soon after this post, but forgot to post an update. For everyone searching THIS is your issue!