Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List of Values

Status
Not open for further replies.

BrianTyler

IS-IT--Management
Jan 29, 2003
232
GB
I have a recurring need to drive ad-hoc one-off enquiries with a list of customer identification codes.

There are too many customer numbers to put them in a 'where' clause, so I need to put them into a temporary table and use this as a joined table or a sub-query

e.g. select cust_no,xxx,yyy,zzz
from tab1,tab2,tab3
where cust_no in
(select ??????????? )

Is there any DB2 syntax to accomplish this, or do I need a real table, populated with query code and customer number.

Thanks

Brian
 
Brian,

Other than the obvious choices you mention, you can also reference a databaseview in the subselect. However,if this is a randomlist of customernumbers you will need to store them somewhere to get them using SQL

This is a bit trivial, so I may be missing your point...

Ties Blom
Information analyst
 
Ties,

Unfortunately I have to agree with you that there is probably no method of introducing sequential lists into a DB2 query.

I asked in the vain hope that someone woul know of an undocumented feature / add-on that could do the job.

For example, BULL used to have a product PDQ (superceded by Interel) which could access sequential files as well as a database. The sequential file would be treated like a table scan.

Anyway, I think I'll get on to creating a table to hold the lists of customer numbers.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top