parameter query with a list as input to an In (__, __, __) construct

R

randy smith

I know that the following works for a single value
(e.g., 'XYZ') entered for parameter "ticker_list":

PARAMETERS [ticker_list] Text;
SELECT Ticker, Industry
INTO DestinationTable
FROM SourceTable
WHERE ticker IN ([ticker_list])
GROUP BY ticker, Industry

....but what if I want values for tickers 'XYZ' and 'ABC'?
If I were hardcoding the criteria, rather than using
parameters, the WHERE clause would read... WHERE ticker In
('XYZ','ABC')
Wondering if this is possible...
 
D

Duane Hookom

You can try something like the following. Keep in mind that typing Johnson,
Smith will match John and Johns.

PARAMETERS [ticker_list] Text;
SELECT Ticker, Industry
INTO DestinationTable
FROM SourceTable
WHERE ticker InStr([ticker_list], [Ticker])>0
GROUP BY ticker, Industry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top