Expand my Community achievements bar.

SOLVED

Writing a Query for Dates to pull most recent first anfd ignore the rest

Avatar

Level 3

Hello Everyone,

I'm attempting to create a query for the workflow in which I must use the data of the customers who have purchased vehicles and then focus on a specific group of customers who have recently purchased vehicles.

Example: I owe four vehicles for a specific brand, but I only want to see the most current one depending on when they were sold, disregarding the other three.

Can someone quickly support me with this?

Thanks in Advance!

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @UmaV ,

 

 

First pull all the customers in the query and then try using deduplication 

For further reference you can go through the documentation Dedup Doc 

SreevarshiniP_0-1677157617779.png

 

 

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @UmaV ,

 

You can use the 'Split' activity after your Query activity to Limit the records depending on certain criteria (@purchaseDate or @soldDate may be in your case). Here you can select the column from the table and sort it in Descending order and then limit the max size to 1 and you will get the latest car that was sold/bought by that customer.

Link for more info on 'Split' activity.

 

_Shubham_Goyal__0-1677131122028.png

 

Br,

Shubham

 

Avatar

Level 3

Updated:

Hi @Shubham_Goyal__ 

Many, thanks for the quick response, let me give a try and let you know on it.

can you please let me know what to choose over here? and the concept of choosing them?

UmaV_0-1677131760733.png

 


Thank you!

Avatar

Level 3

Hello @Shubham_Goyal__ 

 

When I apply the requirement to limit the maximum sixe to 1, the other results trickle in as complements.

UmaV_0-1677150302446.png

 

Nevertheless, I would need all of the distinct information about the audiances sorted in ascending order, and I would need to receive the results as a subset with the most recent date as the result.

 

Ex: I owe five vehicles each of which I purchased on a separate date. However, the query should return the most current vehicle I purchased in response to all the occurrences of the query in the database.

Avatar

Correct answer by
Level 3

Hi @UmaV ,

 

 

First pull all the customers in the query and then try using deduplication 

For further reference you can go through the documentation Dedup Doc 

SreevarshiniP_0-1677157617779.png

 

 

Avatar

Level 3

Many thanks, Sreevarshini

This worked the way I expected