Having difficultly removing the newest records from a table. I've probably gone about it the wrong way in the first instance but I've made it this far I've created a temporary table, inserted the records (entityid, addressid and startdate of the address) and then just want to remove the newest record for each EntID.
What i want to do is pick out the AddressID's with the newest date and remove them, but i'm getting an error because the addID is not in the select statement:
Error report -
SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got DATE
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
any ideas?
B@
What i want to do is pick out the AddressID's with the newest date and remove them, but i'm getting an error because the addID is not in the select statement:
Error report -
SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got DATE
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
Code:
CREATE TABLE ENTADD(EntID number(10), AddID number(10), StDate date);
Insert BLAH BLAH
DELETE FROM ENTADD
WHERE AddID in
(SELECT MAX(StDate)
FROM ENTADD
GROUP BY EntID);
any ideas?
B@