0

I have two tables Fact and Dimension. Dimension contains two fields ID and ObjectID. Fact contains DimensionKey which join to the ID in Dimension. ID is unique but ObjectID is not. This is a versionning mechanism. All rows having the same ObjectID are actually different versions of the same object.

I am trying to find the count of all Facts pointing to all versions of Dimensions for a certain object.

Moslem Ben Dhaou
  • 6,897
  • 8
  • 62
  • 93

1 Answers1

0

If I understand correctly try

SELECT d.objectid, COUNT(*) total_facts
  FROM fact f JOIN dimention d
    ON f.dimentionkey = d.id
 GROUP BY d.objectid
peterm
  • 91,357
  • 15
  • 148
  • 157