Wp code to retrieve values of a pair of columns from a table matching certain criteria


I have a table named "table" with 2 fields- fielda and fieldb.

Now, I have with me a set of comma separated values for matching with fieldb.

What I want to do is, obtain all pairs of values of fielda and fieldb where fieldb of table matches a value from the set of comma set of values for matching with fieldb. After that I can process the pairs of field+fieldb values obtained.

How do I do this using WP code? I have done this for fetching a single col value from a table- just dont know how to fetch pair of values, then process each pair at a time.

Yours sincerely,