0

I would like to add columns by following window function.

select goods_code,event_code ,DENSE_RANK() Over (
Order By case when goods_code = "aaaa" then 1 end,
         case when event_code = "a" then 1 end)
from atai.pricing_pattern

but it returned following error.

ERROR:  column "aaaa" does not exist
LINE 1: ...ENSE_RANK() Over (Order By case when goods_code = "aaaa" the...
                                                             ^

What is the root cause of this? if someone has opinion,will you please let me know Thanks

Heisenberg
  • 4,787
  • 9
  • 47
  • 76
  • 1
    Use single quotes here. See this question for an explanation about single vs double quotes: https://stackoverflow.com/questions/41396195/what-is-the-difference-between-single-quotes-and-double-quotes-in-postgresql – Piemol Oct 03 '22 at 07:18
  • https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS 4.1.1. Identifiers and Key Words – jian Oct 03 '22 at 07:37
  • See [String constants](https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS) in the Postgres manual –  Oct 03 '22 at 07:47

0 Answers0