The error "Only Aggregate Expressions Use Field Aliasing" happens in SOQL when you try to use an alias (AS) incorrectly. Aliases are only allowed with aggregate functions like COUNT, SUM, or GROUP BY.
Example of Incorrect SOQL:
SELECT Name AS AliasName FROM Account
This throws the error because AS is not valid here.
Correct SOQL:
If you want to use aliases, apply them to aggregate expressions:
SELECT COUNT(Id) AS TotalAccounts FROM Account
For non-aggregated fields, just list the field names:
SELECT Name FROM Account
I hope this explanation resolves your issue! Check here for more details.