Skip to content
Advertisement

Spark SQL column doesn’t exist

I am using Spark in databricks for this SQL command. In the input_data table, I have a string for the st column. Here I want to do some calculations of the string length. However, after I assign the length_s alias to the first column, I can not call it in the following columns. SQL engine gives out Column ‘length_s1’ does not exist error message. How can I fix this?

Advertisement

Answer

You can’t use aliases in the same select

So do

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