J
Jay
I'm slowly learning SQL and have been setting myself small
tasks/problems to solve as a way of doing so.
One of these was to count the unique values in one field. My learning
told me this would be a simple case of:
SELECT COUNT(DISTINCT FieldName)
FROM tblName
However as I'm sure you know it isn't. *Many* attempts and several
googles later I got:
SELECT COUNT(*)
FROM (SELECT DISTINCT FieldName FROM tblName)
which runs OK but when 'filtered' through the QBE grid gives:
SELECT COUNT(*) AS Expr1
FROM [SELECT DISTINCT(FieldName) FROM tblName]. AS[%$#@_Alias]
This is the first time I've seen this - what looks like a
dummy/temporary table in the QBE grid.
Can anyone tell me what's going on or point me to some good on-line info
about this.
Many thanks,
Jason
tasks/problems to solve as a way of doing so.
One of these was to count the unique values in one field. My learning
told me this would be a simple case of:
SELECT COUNT(DISTINCT FieldName)
FROM tblName
However as I'm sure you know it isn't. *Many* attempts and several
googles later I got:
SELECT COUNT(*)
FROM (SELECT DISTINCT FieldName FROM tblName)
which runs OK but when 'filtered' through the QBE grid gives:
SELECT COUNT(*) AS Expr1
FROM [SELECT DISTINCT(FieldName) FROM tblName]. AS[%$#@_Alias]
This is the first time I've seen this - what looks like a
dummy/temporary table in the QBE grid.
Can anyone tell me what's going on or point me to some good on-line info
about this.
Many thanks,
Jason