Please help me with this as I have been unable to get past this problem
When trying to execute this statement:
SELECT distinct grade
FROM tblStudents
ORDER BY Val([grade]),grade;
access tells me that ORDER BY
clause Val([grade])
conflicts with Distinct
How can I fix this?
Thank you in advance
Without a transformation, a statement that contains both DISTINCT and ORDER BY would require two separate sorting steps-one to satisfy DISTINCT and one to satisfy ORDER BY. (Currently, Derby uses sorting to evaluate DISTINCT. There are, in theory, other ways to accomplish this.)
DISTINCT is used to filter unique records out of all records in the table. It removes the duplicate rows. SELECT DISTINCT will always be the same, or faster than a GROUP BY. In the following table duplicate records are present.
There is no way this query can be executed reasonably. Either DISTINCT doesn't work (because the added extended sort key column changes its semantics), or ORDER BY doesn't work (because after DISTINCT we can no longer access the extended sort key column).
You cannot order by a column thats not listed in a select distinct statement; if you want grade coerced to an integer;
SELECT DISTINCT Val([grade])
FROM tblStudents
ORDER BY Val([grade]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With