I have a table with (Date(as date data type), Name, …) and i now want to add a column(on the right side), where it does something like this:
If Month =<6 (fill the cell in the row) with S+YY(YY being the Year in the date column) else (fill the cell with W+YY).
I came up with this:
SELECT *,
CASE
WHEN MONTH(Termin) < 6 THEN 'S' + YEAR(Termin)
ELSE 'W' + YEAR(Termin)
END as new_test FROM Prüfung; //Termin is the name of the column where the date format is in.
I am getting the error thingy saying that from is not in the right place?
CREATE TABLE "PRÜFUNG"
( "PRÜFUNG_ID" NUMBER(30,0),
"TERMIN" DATE,
"PRÜFUNGSFORM" VARCHAR2(30),
"RAUM_ID" NUMBER(30,0),
"MODUL_ID" NUMBER(30,0),
"LEHRVERANSTALTUNG_ID" NUMBER(30,0),
CONSTRAINT "PRÜFUNG_PK" PRIMARY KEY ("PRÜFUNG_ID")
USING INDEX ENABLE
)
This is code i used to generate the table.