Can somebody please explain the reason for the phenomenon I am seeing? I am going to paste the screenshot of the code and output below to make it easy to explain my problem.
Problem: The Left Join that I am performing between two tables is sorting my output data alphabetically when I just select particular columns but not when I select all columns in my left table.
Code 1: This is where the sorting problem is coming:
SQLQuery = _
_
"SELECT TOP 10 VersionNumber, CLA_VersionNumber " & _
_
"FROM (" & _
"[FullPolicyList$] AS FPL) " & _
"LEFT JOIN (SELECT CLA_VersionNumber FROM [ClaimsList$]) AS CL ON CL.[CLA_VersionNumber]
= FPL.[VersionNumber] "
Output 1: Open this link to see how the output looks like, the result is sorted A-Z
Code 2:
SQLQuery = _
_
"SELECT TOP 10 * " & _
_
"FROM (" & _
"[FullPolicyList$] AS FPL) " & _
"LEFT JOIN (SELECT CLA_VersionNumber FROM [ClaimsList$]) AS CL ON CL.[CLA_VersionNumber]
= FPL.[VersionNumber] "
What do you think is causing the sorting issue when selecting particular columns instead of all columns?