Writing a Query for Dates to pull most recent first anfd ignore the rest | Community
Skip to main content
Level 2
February 23, 2023
Solved

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

  • February 23, 2023
  • 2 replies
  • 1730 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sreevarshini-P

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 

 

 

2 replies

Shubham_Goyal__
Level 6
February 23, 2023

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.

 

 

Br,

Shubham

 

UmaVAuthor
Level 2
February 23, 2023

Hello @shubham_goyal__ 

 

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

 

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.

Sreevarshini-P
Sreevarshini-PAccepted solution
Level 2
February 23, 2023

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 

 

 

UmaVAuthor
Level 2
February 23, 2023

Many thanks, Sreevarshini

This worked the way I expected😊

Sreevarshini-P
Level 2
February 23, 2023

My Pleasure 😊