SQL TABLE
-
Hi All , I have 50,000 entries on my Sql 2005 Table.I would like to know the first time each distinct objects gets in to my table. Lets say object1 has 10 records on my table at diffrent date ,object2 gas 100 records on the table,object3 has 500 records in the table registered at different date. I would like to reterive each objects with there first entry only,how would i do it? Please advice. THank you all
-
Hi All , I have 50,000 entries on my Sql 2005 Table.I would like to know the first time each distinct objects gets in to my table. Lets say object1 has 10 records on my table at diffrent date ,object2 gas 100 records on the table,object3 has 500 records in the table registered at different date. I would like to reterive each objects with there first entry only,how would i do it? Please advice. THank you all
Look into rownumber() and partition int TSQL. Combining these to with order by can give you the row numbers of your objects sorted by dates desc and you want rownumber 1 for each object.
Never underestimate the power of human stupidity RAH