Subject | Re: Firebird restoration problem |
---|---|
Author | robertgilland |
Post date | 2006-02-10T04:59:42Z |
This query returns many records with a count(*) of 2
but this should not be possible since
storeid, deptcode, commoditycode makes up the
primary key of this table.
select storeid,deptcode,commoditycode, count(*)
from commodities
group by storeid,deptcode,commoditycode
having count(*) > 1
This primary key has NEVER been deactivated.
How can this be?
Regards,
Robert.
( BTW we use Firebird 1.5 )
but this should not be possible since
storeid, deptcode, commoditycode makes up the
primary key of this table.
select storeid,deptcode,commoditycode, count(*)
from commodities
group by storeid,deptcode,commoditycode
having count(*) > 1
This primary key has NEVER been deactivated.
How can this be?
Regards,
Robert.
( BTW we use Firebird 1.5 )
> Lookup the table to which the index refers to.
>
> Make sure no-one else is connected.
>
> SELECT *
> FROM MYTABLE A
> JOIN MYTABLE B ON (A.ID+0 = B.ID+0 AND A.RDB$DB_KEY <> B.RDB$DB_KEY)
>
> This will tell you the records that are duplicated. Delete one of
> them, or give it a unique PK value.
>
> Adam
>