Mark-101232 (1/11/2012)
worker bee (1/11/2012)
I know your not inserting columns, :), After you insert you data into the table you are wanting to count the datakey column, if so then your select stmt would be this;Select DataKey Count(*) AS DataKey
FROM TableName
Is this what you're after?
SELECT COUNT(*) AS Total,
COUNT(DISTINCT datakey) AS Uniquedatakey,
COUNT(DISTINCT CASE WHEN landline<>'' THEN landline END) AS Uniquelandline,
COUNT(DISTINCT CASE WHEN mobile<>'' THEN mobile END) AS Uniquemobile,
COUNT(DISTINCT CASE WHEN email<>'' THEN email END) AS Uniqueemail
FROM test
Nearly...
the counts for landline, mobile & email also need to be group by datakey - so the figure for landline must be a unique landline as well as a unique datakey
Thanks