0

https://help.salesforce.com/articleView?id=mc_as_data_view_click.htm&type=0

Each view has some type of event-date creation. When creating my automation and appending the SQL query, I want use ORDER BY on event date in the query but it does not work with views according to MC.

Is there anyway to order the date in ascending order

SELECT 
,c.EventDate AT TIME ZONE 'Central Standard Time' AT TIME ZONE 'UTC' as EventDate
,c.IsUnique
,c.Domain
,cal.uuid__c
,cal.User_uuid__c AS UserUUID

FROM _Complaint c with(nolock)
inner join [contact_all] cal
on c.subscriberKey = cal.id
ORDER BY c.EventDate
1

An SQL query activity ultimately inserts/updates a Relational Database Table - "Data Extension". Relational Database Tables don't sort data within them, unless you create a clustered index on one or more of the columns (you can't do this in SFMC).

So, even if you could sort the output of your query, it would be inserted into the results data extension as an unsorted heap. This is the reason why placing order by clauses in your query activities isn't supported - it would be futile to do and would be expensive in terms of query performance.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.