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

Programming Help - Deleting record if record = "A" ???

Status
Not open for further replies.

OasisChurch

Technical User
Mar 28, 2002
20
Hi All,
Since I am not a programmer I am having a hard time trying to resolve this issue:
SCAN
IF IDFIELD = IDFIELD THEN
DELETE FROM table1
WHERE year = 2002
ENDIF
END SCAN
Basically, I am trying to delete the old 2002 record out
of my table so that only the 2003 record will show

can anybody point me in the right direction?
thanks!!! -- scotta
 
Hi

USE Table1
DELETE ALL FOR YEAR(fielddate)=2002

If you want to remove the deleted records from the table
PACK

But you have to be careful that you are deleting any records needed. I am cautioning since you claim you are not a programmer.

:)

ramani :)
(Subramanian.G)
 
OR YOU CAN DO THIS

DELETE FROM Table1 WHERE YEAR(fielddate)=2002 AND IDFIELD = XIDFIELD

DELETE FROM Table1 WHERE YEAR(fielddate)=2002 AND IDFIELD IN (SELECT XIDFIELD FROM XPTOTABLE....)
 
Also, note you had a WHERE clause.

WHERE is typically used in SQL.

SELECT name from customer WHERE id = 123

and the FOR is typically used on FOX commands such as:

REPLACE
COUNT
DELETE

Jim Osieczonek
Delta Business Group, LLC
 
the delete command whorks also with sql "where" the delete statement syntax is difrent in:

"DELETE ALL FOR" and "DELETE FROM Table1"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top