Skip to content
Advertisement

Making a SQL query that selects of list of values from more than one column

I have a table which is something like this:

AccountNum Name RoutingNum
a1 name1 r1
a2 name2 r2
a2 name3 r1

I want to select all rows with a specific pair account number and routing number, for example :

JavaScript

For some context I just want to make a single call, that I would be making using jdbc, this is my java code which only selects for account number, which is not what I want as I want to select using routingNum too:

JavaScript

I want to avoid making multiple calls to the database for every entry in the list.

Thanks for your time.

Advertisement

Answer

Use an IN condition with multiple expressions in the list:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement