954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

using asp array to store db information

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

arthi
Newbie Poster
1 post since Aug 2004
Reputation Points: 10
Solved Threads: 0
 

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.

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

jwstickley
Newbie Poster
7 posts since Oct 2004
Reputation Points: 10
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You