Hi! what i want to do is when i put a number get the data associated to that number and the next one.
For example i have the following entity database:
YEAR | Description | Start_Date1920 | nice year | 01/01
1819 | bad year | 01/03
1617 | nice year | 01/02
So when i put 1920 i want to retrieve 1920 data AND 1819 data, if a put 1819 i want to retrieve 1819 data AND 1617 Data. I don't know how to do that properly.
Thanks in advance.
Hi Nicolás,
The result set wil have 0, 1 or 2 records based on your year filter value.
Regards,
Daniel
Hi Nicolas,
I'm not sure I understand why you would want that, can you explain more ? For what reason do you already want to retrieve the next one ?
What do you mean by 'I put a number' ? Do you just guess a year that might be in the database and enter it somewhere ?
What is the meaning of the 'next' one. Do you have some sort of ordering attribute that is not shown in your example data, or is it maybe on year descending ??
Let's say it's on descending year, and you somehow know what the 'current' is, let's say you somehow have 1920 to start with.
Then you can just use an aggregate getting all records sorted on descending year, whit as filter year <= current year
the 'current' will be Aggregatename.list[0] and the 'next' will be Aggregatename.list[1]
But again, this seems a bit of an odd requirement, maybe you can tell more about what you would like to accomplish ?
Dorine
You can try this type of SQL, I did it with User Entity.
Result is coming like ->
@Sourav Pasari,
Your solution does not answer the question in best manner.
For the given problem no advanced query is necessary.