Questions tagged [column-alias]
155 questions
-1
votes
1 answer
can't use case as new_c in having or where condition
I'm trying to use CASE in PostgreSQL query and use it in where or having condition and i got this error message
[Err] ERROR: column "new_dismiss" does not exist LINE 14:
trans_requistion_details.original_qty > new_dismiss
SELECT
*,
CASE
…

Tarek Ramadan
- 25
- 6
-1
votes
1 answer
Using NVL function and giving Alias name to same column in Oracle
While using nvl function i just tried experimenting by adding alias name to column to which nvl is applied but encountered error message .
select nvl(commission_pact,0) commission_pact AS "COMM"
FROM employees;
but i am getting error message as…

Rishab Abbhi
- 1
- 1
-2
votes
1 answer
Count over previously defined alias
I'm trying to avoid writing twice the EXTRACT condition. There is any way to do that? Count over the previous alias apparently is not valid.
SELECT EXTRACT(DECADE FROM to_date(released_year::text, 'yyyy')) AS decade,
count(decade) AS…

anvd
- 3,997
- 19
- 65
- 126
-2
votes
1 answer
My as statement does not work in PostgreSQL
I am new to PostgreSQL and I don't know why my "as" statement is not working, below is the query:
with CTE as
(
SELECT *,rank() OVER(partition by Name ORDER BY AdministrationDate desc) AS rank_val
FROM ExamResult
)
select Name as 'Student Name',…

Swayam Shah
- 200
- 1
- 12
-2
votes
1 answer
What is wrong in my sql WITH and SORT in postgresql
In the picture: I using pgadmin 4 and Postgres 9.4.

Lost Heaven 0809
- 396
- 2
- 7
- 23