Skip to Content

JDBC Lookup Returns Multiple Rows

Jun 27, 2017 at 11:37 PM


avatar image

Hi Experts

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?

Kindly assist.



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Muni M Jun 28, 2017 at 01:16 PM

first try if this can be achieved by select query from sender channel itself. you can do the filtering in UDF but it is not required if the channel sql works out.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Muniyappan

Thanks for your response. Do we not need to create a receiver channel for JDBC look ups?




Receiver channel is required doing JDBC lookup. you have to construct the message type as per sql_query

you can use select statement also to fetch records.Please check.

I thought you are fetching records from sender side. That is why i told to configure the sql query in sender channel. I misunderstood. Please ignore sender channel part.