Forums / Developer / Storing relations in SQL base

Storing relations in SQL base

Author Message

Vladimir Shiray

Thursday 11 August 2005 2:33:58 am

I has found that our production EZ base
contains duplicate records in the
'ezcontentobject_link' table.
I say about combination of three fields:
from_contentobject_id
from_contentobject_version
to_contentobject_id

Has it a sense?
Can it be a reson for any problem?
Is it possible to create UNIQUE key
based on these fields?

I removed duplicates in test copy with
direct SQL query:

DELETE FROM ezcontentobject_link
WHERE id NOT IN (
SELECT max(id)
FROM ezcontentobject_link
GROUP BY from_contentobject_id, from_contentobject_version, to_contentobject_id
);

Can it lead to a problem ?