Connecting Tech Pros Worldwide Forums | Help | Site Map

compare one record with several others

Newbie
 
Join Date: Nov 2008
Posts: 2
#1: Nov 19 '08
Please can anyone help? I have several recordsets containing the same number of records and each record having 2 fields. One recordset being the primary the others secondary. I what to compare Primary Record 1 Field 1 with all other secondary record 1's and field 1's then colour secondary Field 1 bgcolor as red if not equal until it reaching eof of each secondary recordset and then eof of the Primary recordset and so on. Example below:

Primary Sec1 Sec2 Sec3 Sec 4 Sec5 Sec6
2 4 2 6 2 4 2 3 2 4 2 5 2 4
2 3 2 4 2 3 4 3 4 4 2 4 2 6
...
...
...

Any help would be most appreciated.

iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,076
#2: Nov 19 '08

re: compare one record with several others


just create 3 instances of ado recordset and use a nested loop.
Newbie
 
Join Date: Nov 2008
Posts: 2
#3: Nov 20 '08

re: compare one record with several others


I have created ADO rs and can display the records, but need help on the netsed loops. Is it worth while creating a nested loop with just the Primary and one other Secondary Record? Example would be most helpful.
iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,076
#4: Nov 20 '08

re: compare one record with several others


Alright first of all I need to know exactly what you are going after, can this just be done in the sql statement itself?
iam_clint's Avatar
Forum Leader
 
Join Date: Jul 2006
Location: Oklahoma
Posts: 1,076
#5: Nov 20 '08

re: compare one record with several others


SQL Example of what you are wanting

select id from tbl1
where id in (select id from tbl2)
and id in (select id from tbl3)
Reply


Similar ASP / Active Server Pages bytes