Reputation: 343
I guess its pretty easy to solve but I don't get it:
SELECT TO_NUMBER(PERS_NR) AS Spieler1, TO_NUMBER(PERS_NR) AS Spieler2
FROM DBS_TAB_MITARBEITER
WHERE Spieler1 < Spieler2;
I get an
unkown identifier
error in the where
clause. Why?
Upvotes: 0
Views: 1275
Reputation: 156958
Your where
clause doesn't work since the fields aren't know at that moment yet. You have to use the real column names:
SELECT TO_NUMBER(PERS_NR) AS Spieler1, TO_NUMBER(PERS_NR) AS Spieler2
FROM DBS_TAB_MITARBEITER
WHERE TO_NUMBER(PERS_NR) < TO_NUMBER(PERS_NR);
When you do that, you immediately see that your query doesn't yield any rows since the where
clause is impossible to result in a true
.
Upvotes: 5