Okay, what I would say first is that you probably have some referential
integrity problems, as the two tables are dependent on each other, and the
completed table shouldn't have any id's in it that haven't already been used
in the current table. But, if you must do this...here's one solution. It's
not the most elegant, and depending on your db, you could probably do this
easier with triggers or something.


<cfquery name="getmax" datasource="yourdb">
SELECT     max(c.id) AS maxid
FROM        currentassingmenttable c
</cfquery>

<cfset newid = getmax + 1>

<cfquery name="checkid" datasource="yourdb">
Select        p.id
from        completetable p
WHERE p.id = #newid#
</cfquery>

<cfif checkid.recordcount GT "0">
Oops, that id was already used! You have to decide what you want to do if
the id was already used...increment....what?
</cfif>

Does that get you started?
-d


************************************************************
Deanna Schneider
Interactive Media Developer
UWEX Cooperative Extension Electronic Publishing Group
103 Extension Bldg
432 N. Lake Street
Madison, WI 53706
(608) 265-7923



------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to