0

I am combining a group of columns to create the specs per each line item. I then will compare these specs to the specs from an excel sheet that have an ID with them. So in the end the ID will be associated with the correct items in the database. To do this, I create a new column called SpecKey and then write a Case statement to compare. Below is some simplified code to show what I am doing. Is there a reason why I cannot use SpecKey in the case statement? And is there a workaround or better way to do this? When I swap SpecKey with an already existing column in the database, the code compiles. But using the newly created column, SpecKey, seems to be the problem. Here is the error I receive in DBeaver: 'SQL Error [42501]: UCAExc:::5.0.1 user lacks privilege or object not found: FULL.SPECKEY'

SQL Code:

 SELECT Flat_Size + '|' + Finish_Size + '|' + STD_PK + '|' + STD_PK_QUANTITY as SpecKey, 
        CASE WHEN FULL.SpecKey IS '4x8|4x4|Each|1' THEN '12345ID'
             ELSE NULL
        END AS TemplateID
 FROM `Table`
  • 1
    Please share the error message and which DB you are using. – nofinator Jun 09 '22 at 19:22
  • 1
    Does this answer your question? [Why can't I use column aliases in the next SELECT expression?](https://stackoverflow.com/questions/34955911/why-cant-i-use-column-aliases-in-the-next-select-expression) – Stu Jun 09 '22 at 19:25

0 Answers0