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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add item to a list and check that it's not on list

Status
Not open for further replies.

rollypac

Programmer
Jun 13, 2003
23
0
0
US
I have a file with an id# and table id#.
I used seek to check if the id# is there. How do I get it to look at all instances of that id# and check if the table id# is there or not, and add if not?
 
You have lots of choices here. I'll assume you don't have an index tag on the combination of ID and TableID, but do have indexes on each of them separately. If so, your best bet is probably code like this:

Code:
SELECT YourTable
LOCATE FOR ID = m.nID and TableID = m.nTableID
IF NOT FOUND()
   INSERT INTO YourTable ;
     (ID, TableID) ;
     VALUES (m.nID, m.nTableID)
ENDIF

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top