Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 4th, 2004, 11:00 AM
Authorized User
 
Join Date: May 2004
Location: London, London, United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Seb_soum
Default Compare 2 tables....

I have 2 tables. tblJobs and tblquotes. I need an ASP page to compare 4 fields in each, if it meets the criteria, then write to HTMl.
the fields in both are:
surname, forname, dest_code. These have to match exactly, but then the 4th field "who_create" has to be different....so any help would be appreciated......thanks guys
Reply With Quote
  #2 (permalink)  
Old June 4th, 2004, 11:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

Just open two recordsets, one for each table, and compare the fields by

if ( objRS("surname") = objRS2("surname") ) then
... etc ...

Is this even close to what you are looking for? Are we talking one record or more than one? In addition, what database are you using?

Thanks,

Brian
Reply With Quote
  #3 (permalink)  
Old June 4th, 2004, 05:47 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Minneapolis, MN, USA.
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think this syntax is correct for an ASP union query and it might work. I'm just not sure if it grabs distinct out of each table or both without trying it out first. Either way it is pretty close to what you need without having to compare things with your code.

sql = "select distinct tblJobs.SurName AS SurName, tblJobs.ForName AS ForName,"
sql = sql & " tblJobs.Dest_Code AS DestCode tblJobs.Who_Create AS WhoCreate"
sql = sql & " from tblJobs"

sql = sql & " unionall"

sql = sql & "select distinct tblQuotes.SurName AS SurName, tblQuotes.ForName AS ForName,"
sql = sql & " tblQuotes.Dest_Code AS DestCode tblQuotes.Who_Create AS WhoCreate"
sql = sql & " from tblQuotes"

sql = sql & " order by whatever...

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare 2 tables in 2 different DBs Feodorov SQL Server 2005 4 March 7th, 2008 07:08 AM
Compare two fields from different tables pallone SQL Server 2000 10 March 23rd, 2007 05:14 PM
Compare records between two tables jaaboston Access VBA 1 December 21st, 2006 04:35 AM
compare these date fields and compare and get the susanring Oracle 1 July 24th, 2006 04:58 PM
how to compare tables data ramanadyv SQL Language 0 April 10th, 2006 04:38 AM



All times are GMT -4. The time now is 04:10 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.