User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 375,210 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,277 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 14396 | Replies: 1
Reply
Join Date: Aug 2004
Posts: 1
Reputation: arthi is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
arthi arthi is offline Offline
Newbie Poster

using asp array to store db information

  #1  
Oct 25th, 2004
undefinedhi,
I am new to asp and trying to get information from a table and make an array of it using an asp variable and then use it for further processing .
The problem is the my sql query returns data this way
Id
16
27
95
97
90,89,65,45,44
78
87
93

I need to get all these values(which includes all the comma separated .I need to use this information in another sql query which then returns me more info
is this possible?
The next table has more information on this column with which i can eliminate the duplicate and extra values.

Thanks,
arthi
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Posts: 7
Reputation: jwstickley is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
jwstickley jwstickley is offline Offline
Newbie Poster

Re: using asp array to store db information

  #2  
Oct 26th, 2004
If you collect the result set from your first query into a coma separated string as follows:

16,27,95,97,90,89,65,45,44,78,87,93

then, you can then embed this string in the second query as follows:

select * from your_second_table where id in ( 16,27,95,97,90,89,65,45,44,78,87,93)

The only problem with this is that the second query will fail if you have too many items in the list (Max number depends on your DB). The better solution would be to design the tables so you could join the two tables in a single query. The only problem I see for you is you have a column that has multiple values in it (poor design).

If you provide more details on the layout of the tables and the queries you are running, I might be able to give you more specific advice.

Originally Posted by arthi
undefinedhi,
I am new to asp and trying to get information from a table and make an array of it using an asp variable and then use it for further processing .
The problem is the my sql query returns data this way
Id
16
27
95
97
90,89,65,45,44
78
87
93

I need to get all these values(which includes all the comma separated .I need to use this information in another sql query which then returns me more info
is this possible?
The next table has more information on this column with which i can eliminate the duplicate and extra values.

Thanks,
arthi
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP Forum

All times are GMT -4. The time now is 2:52 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC