I have a scenario where I have to lookup the "company name" for a user from a JDBC table. A user may have multiple companies associated. There is another column "Last Updated Date" so I need to pick the company with the latest LastUpdatedDate.
The table looks like
User CompanyName LastUpdateDate
A CompanyA Date1
A CompanyB Date2
B CompanyC Date1
D CompanyB Date3
So while looking up is it possible to send a query something like "order by
LastUpdatedDate" and then pick the first record?
Would have to write a udf to fetch all the records?
can it be done without a udf?