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

  • Thread starter Thread starter randy smith
  • Start date Start date
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...
 
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
 
Back
Top