How to make query table do pivots?

How to make query table do pivots?

I want to do pivots in query table like in the using the SQL below.

It says error near "yellow" highlight.

SELECT pvt.* FROM (SELECT "ID", "Stage" from "Rawdata" ) PIVOT Count("ID") FOR  "Stage" ([01New], [02L10], [03G10]) AS pvt