Select with column names does not maintain the order (returns in alphabetical order)

select with column names does not maintain the order (returns in alphabetical order).

is there any way to force the order?

SELECT querycache.Name, CompanyId, MC, EY, CMP, PE, EPS, FV from querycache

it is returning in alphabetical column order like CMP, CompanyId,… and so on.

Thanks in advance

As every value is attached column name and easy to spot it returns in alphabetical order. There is no way avoid this.

Thanks. I tried looking up a lot in google and forums but could not find anything so was wondering is this is the case.

In some case order matters, I will just do it on application side.

Yes. In a very structured data, the order can be guaranteed.

In N1QL, you should avoid reading the results by position, but should ready by key-name.
When you’re working with flexible schema, reading by position may cause issues when some data is missing or some structure has changed.

Alternative is Alias the column name with prefix c001_, c002_, c003_,… and you can strip it if needed in client.

SELECT querycache.Name AS c001_Name, CompanyId AS c002_CompanyId, MC AS c003_MC,…
FROM querycache