Create new row depending on Column value

ruedi

I have a Table

ID|ProjectNr|Start|End|Name|

I want to generate an output like this:

|Name|End-Start for ID1|End-Start for ID2|

What I tried is

Select Name,
Case ProjectNr When 1 then datediff(Minute, Start, End) Else 0
From Table

I always get From underlined with the message Incorrect Syntax near from. Maybe I am blind but can anyone tell me what is wrong with the query please?

Giannis Paraskevopoulos

You forgot the word END in the end of your CASE statement.

Select Name,
Case ProjectNr When 1 then datediff(Minute, Start, End) Else 0 END
From Table

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

SQL - Create two new row entries depending on specific column values

New Pandas column with cumulative value depending on condition on the previous row

How to create new columns depending on row value in pandas

Create a new column based on previous row value and delete the current row

Create new dataframe column and generate values depending on the previous rows value of this same column

Check content of multiple columns of one row and add new column with value depending on contents

get row and column depending on value using SQL?

Copying and Pasting Row and Column Depending on cell value

How to create a new row for each comma separated value in a column in pandas

Create a postgres trigger on new row with specific value in column

pandas create new column based on row value (condition)

Create new column from a row value in a grouped data frame?

pandas - create new column based off of 'next' row value

reading csv and create row -1 as value in new column

awk calculate the difference with last row and create new column with value

How to create a new column for difference of value conditionated to other row values

Create new column in Python and use value from previous row

Create new variable if second row of a column matches a value in r

Collapse id with new value depending on another column

Create a pandas dataframe column depending if a value is null or not

Create a new column that counts ";" in a row

Create a new tibble using the previous row value of a column as a parameter of the current row value

How can I calculate a new column depending of the value from my column? I need to create string chains to create my new column in pandas python

Spark create a new string column based on max value of row_number and string value of another column

Pyspark: how to create a new column and match the column's value condition with row value

Create new column depending on values from other column

Updating pgsql table setting new value depending on row previous value

Split column value to a new row

add new column in a dataframe depending on another dataframe's row values