Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Getting the row I just inserted

Posted on 2000-02-17
2
Medium Priority
?
156 Views
Last Modified: 2013-12-24
Using CFQUERY and SQL, how do I get the row I just inserted - I have a column that is an AutoNumber, and I need to get the number of the record I just added so I can refer to it in other tables. Help!
0
Comment
Question by:Arachn1d
2 Comments
 
LVL 4

Accepted Solution

by:
FRehman earned 100 total points
ID: 2534350
<cfquery name="GetName" datasource="#DSN#">
select max(columnid) as maximum from table1
</cfquery>
use this columnid for another table
<cfquery name="hello" datasource="#DSN#">
select * from table2
where table2.testid=#GetName.maximum#
</cfquery>
this is you requrment
0
 

Author Comment

by:Arachn1d
ID: 2536263
Not really what I was looking for, but I came up with an alternative in the mean time.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

824 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