Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare string values from two tables

Status
Not open for further replies.

sbbrown9924

Technical User
Mar 7, 2003
80
US
In a repeat region whenever there is a match of string text from one table compared with another, then I would like to set the background of one of the table cells. Something like...

<td background="<%IF {a match exists between strings} Then Response.Write("/images/blinking.gif")%>">&nbsp;</td>

I have this query that compares strings from two different tables. How would it be indicated that a match exists in this query? Thanks.


The comparison query is:

SELECT TrackingMain.LastName, TrackingMain.FirstName, TrackingMain.Age, TrackingMain.Sex, FrequentVisitors.LastName, FrequentVisitors.FirstName, FrequentVisitors.Age, FrequentVisitors.Sex
FROM [c:\Inetpub\databases\Tracking.mdb].TrackingMain, [c:\Inetpub\databases\FrequentVisitors.mdb].FrequentVisitors WHERE FrequentVisitors.Lastname=TrackingMain.LastName AND left(FrequentVisitors.Firstname,4)=left(TrackingMain.Firstname,4) AND FrequentVisitors.Sex=TrackingMain.Sex AND ((FrequentVisitors.Age=TrackingMain.Age) OR (FrequentVisitors.Age=TrackingMain.Age+1))

 
Do you really want to run the query for every row in the table?

Would it be easier to draw the table first then write a little client side script to go through the table and change the backgrounds?
 
xwb;

The TrackingMain table is only 40 records - each record represents an Emergency Room bed. Probably the client-side script to go through the table would be best. Part of my question was out of curiosity. I've been learning jet sql and vbscript and now am starting to get into ado. Thanks.

 
At a guess it is something like
Code:
select count(*) from ...
In your if, check whether you are getting 0 or non zero coming back from the record set. You may have to have two record sets going.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top