Solved

ColdFusion Database Record Comparison -- How?

Posted on 2014-02-06
2
194 Views
Last Modified: 2014-04-08
Hello Experts:
I am in a jam today as I have been hitting my head against the wall for a couple of days now.

Simply:
I have an access database with two fields -- SCRUB NSCRUB

I need to take the values one at a time that are in NSCRUB and see if they exist in SCRUB, if they do, then just show to screen "Record Exist: "data in the record"

It is really that simple. I have written a cfquery and cfloop and the best I can get is for the code to run until it finds the record from NSCRUB in SCRUB, and that is it, it will never go onto the next record in NSCRUB and try to find it. It just stops at the first record and doesn't try to find any records past the first.

I can past code, but really it is all of 8 lines and not sure it would even help???

Thank you so much!!
0
Comment
Question by:sscottinandrews
  • 2
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 39840104
Assuming both columns contain simple values, it could be as simple as a self join:

SELECT s.Scrub TheValueThatExistsInScrub
FROM   YourTable n INNER JOIN YourTable s ON s.Scrub = n.NScrub

Sample Data
Row | NSCRUB | SCRUB
1 | 9   | 1  
2 | 6   | 4  
3 | 18  | 6  
4 | 17  | 19  
5 | 53  | 42  
6 | 42  | 85  

Result:
Row | THEVALUETHATEXISTSINSCRUB
1 | 6  
2 | 42
0
 
LVL 52

Expert Comment

by:_agx_
ID: 39840252
BTW, this seems like more of a SQL question. However, for ColdFusion specific stuff, you will get more attention from the CF experts if you include one of the CF zones in your question topics, such as

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Cold_Fusion_Markup_Language/
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now