May 29, 2015 at 11:38 am
I have the following expression;
Cust_nr between 9950001 t/m 9959999 then 2, Cust_nr between 9980001 t/m 9989999 then 3 and others 1
I like it to do it on a select statement
select Cust_nr between 9950001 t/m 9959999 then 2, Cust_nr between 9980001 t/m 9989999 then 3 and others 1 as CUST_CODE_Nr
from cust_nr
Do somebody how to make a good syntax for this?
Tnx
May 29, 2015 at 11:44 am
GG_BI_GG (5/29/2015)
I have the following expression;Cust_nr between 9950001 t/m 9959999 then 2, Cust_nr between 9980001 t/m 9989999 then 3 and others 1
I like it to do it on a select statement
select Cust_nr between 9950001 t/m 9959999 then 2, Cust_nr between 9980001 t/m 9989999 then 3 and others 1 as CUST_CODE_Nr
from cust_nr
Do somebody how to make a good syntax for this?
Tnx
This??
select
case when Cust_nr between 9950001 and 9959999 then 2
when Cust_nr between 9980001 and 9989999 then 3
else 1
end CustCodeNr
from
dbo.CustTable;
May 29, 2015 at 2:29 pm
TNX 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply