Advertisement

07.24.2008 at 12:47PM PDT, ID: 23593545
[x]
Attachment Details

Case stmt error

Asked by fahVB in MS SQL Server, SQL Server 2005

I am trying to run following query, it runs fine but not giving me the correct results back, if someone can please check this case stmt and let me know where the problem is, i want "then" within case stmt to return [24], which i am using in select, select [24], [24] is a field/column  name, I can take out the select from case stmt and run seperatley and it runs fine....

select CONVERT(numeric(10), m.acct) as CUSTNUM, m.branch as AORGID, l.sub as PRODID,
l.code as ALNTYPE,

case when exists (select [24]
from
(
select joinfield = datename(m, opened) + cast(year(opened) as varchar(4)), *
from loan
) a
inner join
(
select joinfield = datename(m, date1) + cast(year(date1) as varchar(4)), *
from FHLB
) b on a.joinfield = b.joinfield) then '[24]' else 'norate' end as FTPRATE

from memb m
INNER JOIN loan l on m.rowno  = l.rowno_membloan_memb
INNER JOIN lohi h on l.rowno = h.rowno_loanlohi_loan
and m.acct = 11407
where l.status not in ('closed','delinquent','writeoff','cancelled')
group by m.acct,m.branch,l.sub,l.code


results,

FTPRATE column just coming back as [24],...Start Free Trial
 
Loading Advertisement...
 
[+][-]07.24.2008 at 12:57PM PDT, ID: 22082897

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 01:13PM PDT, ID: 22083079

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 01:22PM PDT, ID: 22083173

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 01:27PM PDT, ID: 22083218

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 01:29PM PDT, ID: 22083235

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 01:36PM PDT, ID: 22083282

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 01:44PM PDT, ID: 22083340

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 01:46PM PDT, ID: 22083362

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 02:46PM PDT, ID: 22083858

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 05:50AM PDT, ID: 22087968

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 05:54AM PDT, ID: 22088010

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 05:59AM PDT, ID: 22088058

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 06:13AM PDT, ID: 22088184

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 06:53AM PDT, ID: 22088559

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 11:08AM PDT, ID: 22090923

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, SQL Server 2005
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628