Solved

ColdFusion Database Record Comparison -- How?

Posted on 2014-02-06
2
199 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
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…

679 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