on 03-05-2009 7:48 PM
I am trying to create a derived table and I get the error
"each calculated column must have an explicit name"
I added the as shiptype to the end of the line and that did not work. Any thoughts?
shiptype = case when araddr.invno is not null then 'ADDR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end as shiptype,
Thanks
Jeff
>
> "each calculated column must have an explicit name"
> Jeff
you have to gave an alias for the column names
like
select salary*10 as new_salary from emp;
you made a calculation in the select statement and you need to give this calculation an Alias ( as new_salary)
make if for all the columns,
good luck
Amr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jeff,
your select statement should look like this...
select column1,column2,(case when araddr.invno is not null then 'ADDR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end) as shiptype from Table
This will work....
Cheers,
Ravichandra K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jeff,
your select statement should look like this...
select column1,column2,(case when araddr.invno is not null then 'ADDR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end) as shiptype from Table
This will work....
Cheers,
Ravichandra K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jeff,
It will depend on the db you are connecting to.
A standard one would be
SELECT
Dim1,
Dim2,
Active,
CASE
WHEN Active = 'Y'
THEN 'Active'
ELSE 'In Active'
END as ActiveText
FROM
My_Table
What is your DB?
Regards
Alan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.