Skip to content
Advertisement

Subquery must have alias despite having alias?

I have an Alias at the bottom (AS crypto). However, I still get the “subquery in FROM must have an alias” error. And then HINT “For example, FROM (SELECT …) [AS] foo.” I see many other posts that say to “just add AS _” as an alias, but mine still isn’t working. What am I doing wrong?

Advertisement

Answer

Remember:

  1. We can’t put an aggregate in a where clause

  2. We can’t use DISTINCT with aggregates

I believe what you want is “By account ID, the total unit count summed across the four listed asset transfer types for any account ID that has a unit count of more than 0.025 bitcoin, or more than 0.4 ethereum, or more than 1000 internal or more than 5000 stellar”.

In which case:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement