-1

I'm triyng to add a the done value to where clause, so I can show only results from todo, that are already done, but keep getting an error:

select "todo", SUM( "test"."count" ) as "done"
from B 
Where "done" =  "todo"

this is the error:

q_driver: [PGRES_FATAL_ERROR]ERRORE: the column "done" don't exist

but the column is displayed if I remove the where clause

user2239318
  • 2,578
  • 7
  • 28
  • 50

1 Answers1

0

You cannot use alias name in same select query where clause

select * from
(
select "todo", SUM( "test"."count" ) as "done"
from B 
GROUP BY "todo"
)
Where "done" =  "todo"
Pரதீப்
  • 91,748
  • 19
  • 131
  • 172