Link to home
Start Free TrialLog in
Avatar of parpaa
parpaa

asked on

select query

Hi all,

Please find my attached select query, I am trying to use case statements in the select query to create new columns. Please correct my query.

Thanks in advance
parpaa  
select acno, datediff(dd,dateadd(dd,-19,[duedate]),getdate()) as deli,'over due'=case when
datediff(dd,dateadd(dd,-19,[duedate]),getdate())>19 then 'YES' else 'NO'
end ,'service line'= case when[subs]='*ISDN'then 'PRI' else '-' end,
'PRI'= case when
(case when[subs]='*ISDN'then 'PRI' else '-' end)
then 1 else 0
end
into t1 from tabel

Open in new window

SOLUTION
Avatar of Dileepan
Dileepan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of parpaa
parpaa

ASKER

Thank you so much for your help. it worked