473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

loop through records and disregard equal values

hi everyone, i need some assistance.


i need to compare records from table A (database A) and records from table B (database B) and display list of this records. But i need to filter the list first and disregard agencies in table A that is already existing in table B. Anyway here's a draft of my code:

Expand|Select|Wrap|Line Numbers
  1. Set RS = SERVER.CreateObject("ADODB.Recordset")
  2. dts = "SELECT ID,officename,abbrev FROM lu_office ORDER BY ID"
  3. RS.open dts, cn_dts
  4. iddts = RS.getRows()
  5.  
  6. Set RS_map = SERVER.CreateObject("ADODB.Recordset")
  7. map = "SELECT * FROM map_agencies ORDER BY ID_dts"
  8. RS_map.open map,cn_yass
  9. dtsmap = RS_map.getRows()
  10.  
  11. For i = LBound(iddts,2) to UBound(iddts,2)
  12.     if iddts(0,i) <> dis then
  13.     For j = LBound(dtsmap,2) to UBound(dtsmap,2)
  14.         if iddts(0,i) <> dtsmap(1,j) then
  15.             Response.Write iddts(0,i) &" - "&dtsmap(1,j)&"<br>"
  16.         end if
  17.         if iddts(0,i) = dtsmap(1,j) then
  18.             dis = dtsmap(1,j)
  19.             Response.Write "DO NOT SHOW THIS: " & dtsmap(1,j) & "<br>"
  20.             exit For
  21.         end if
  22.     next
  23.     end if
  24. next
  25.  
its fine until for i loop for the third time coz the list again shows records existing in table B.

need help badly.
Thanks in advance!
Dec 16 '10 #1
1 1564
jhardman
3,406 Expert 2GB
Look up the sql keyword "union", see if that answers your question (by default disregards duplicates in two different tables).

Jared
Dec 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tom Fitzgibbon | last post by:
Stupid question: How do I loop through many text boxes on a page and get values for each box and put into an array? For example document.CreateEvent.test1.value will not take an array value...
3
by: Kant | last post by:
Hi, i have a simple problem. i have a form with a lot's of number of Text and Hidden Fields. I just do a simple loop to get each value for each attribute. I have about more than 2000. if i do...
1
by: david | last post by:
Hi, Gosh I've seen this b4 but I couldn't google it, ah just found it eg search for records having same email address select txtemail,count(txtemail) from `tbl_user` GROUP BY txtemail having ...
0
by: jainapurva108 | last post by:
Hi, I have one table with some values as shown in below format... Column-A Column-B Column-C Column-D Column-E 11AA ------ 1234 ------ ASDF------ FIRST ------ONE 22BB ------ ...
2
ak1dnar
by: ak1dnar | last post by:
Hi all, I am getting this error in my ASP.net App, when reading some records which contains Null values for some of the columns. System.Data.SqlTypes.SqlNullValueException: Data is Null....
4
by: paulquinlan100 | last post by:
Hi I have the following query: SELECT qryBlackbook.* FROM qryBlackbook inner JOIN qryLatestMeetingDate ON (qryBlackbook.Site_Ref = qryLatestMeetingDate.Site_Ref) AND...
2
by: JC2710 | last post by:
Hi I would like a Query that Updates a field to indicate that records have a duplicate entry( records with same values). My table is ..... Code........Process..........Quantity ...
6
by: VivDenham | last post by:
Hi there I am brand new to VBA - a 61 year old lady who likes machine knitting. For the last couple of years, I have been designing an Access database called Knitting Database. I want a...
12
by: KPR1977 | last post by:
In an Access Database for field2, the data values could consist of the following: ---field1-------------field2------- Widget 1-----112398764567 Widget 2-----987611236789 Widget...
1
by: manhaz | last post by:
In this project I have 2 Combo boxes, 1 Button and 1 GridViewControl. Both the combo boxes have some variables and their associated values, as u can see in the code. Now when the button is pressed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.