SQL IN function question. [message #259946] |
Thu, 16 August 2007 22:01 |
aspectweaver
Messages: 3 Registered: July 2007
|
Junior Member |
|
|
select distinct cardnum from transactions where lanenum in('K01', K02');
Oracle version: Oracle 8i(8.1.7.0)
In the transactions table, each row of the table is a transaction with an associated cardnumber. Therefore there can be multiple instances of the same card number in the table. I am using php to access the database and I was wondering if there was any way to dynamically add arguments to the IN clause because the number of lanes I want to search in won't be the same every time.
Cheers
|
|
|
Re: SQL IN function question. [message #259947 is a reply to message #259946] |
Thu, 16 August 2007 22:13 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
This is really a PHP programming question & the SQL would be valid going against many/most RDBMS.
I really am not sure exactly what you are asking.
You'll have logic in your code that is either some sort of loop or ("large") nested IF tree to build the contents of the IN list.
I did something like this using PERL.
I had a loop where I'd add "ITEM," as needed.
After the loop terminated, I appended onto the string "DUMMY)"; where DUMMY was a value that I knew would never be matched.
|
|
|