Hi rajanisqldev-42, Thank you for posting query in Microsoft Q&A Platform.
Yes, order should be same. But you can consider using
CETAS
also in your case.
-- use CETAS to export select statement with OPENROWSET result to storage
CREATE EXTERNAL TABLE population_by_year_state
WITH (
LOCATION = 'aggregated_data/',
DATA_SOURCE = population_ds,
FILE_FORMAT = census_file_format
)
AS
SELECT decennialTime, stateName, SUM(population) AS population
FROM
OPENROWSET(BULK 'https://azureopendatastorage.dfs.core.windows.net/censusdatacontainer/release/us_population_county/year=*/*.parquet',
FORMAT='PARQUET') AS [r]
GROUP BY decennialTime, stateName
GO
-- you can query the newly created external table
SELECT * FROM population_by_year_state
Please consider hitting Accept Answer
button. Accepted Answers help community as well.