Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1031
  • Last Modified:

SQL Server view error: View Definition includes no output columns or includes not items in the from Clause

Hi All,
When i try to save my view this is what i get :
 "View Definition includes no output columns or includes not items in the from Clause"
The code is :
SELECT     SUM(CASE WHEN [event].[addDate] >= '10/1/2004' AND [event].[addDate] < '12/1/2004' AND [anh_Structural_RFI_sent] = - 1 AND
                      CallType.TypeName = 'consumer rep' THEN 1 ELSE 0 END) AS NumberOfRFISent
FROM         Call INNER JOIN
                      Event ON Call.Call_ID = Event.Call_ID INNER JOIN
                      CallType ON Call.CallType_ID = CallType.CallType_ID

Thanks :)
0
Taly_ly
Asked:
Taly_ly
1 Solution
 
nmcdermaidCommented:
What happens when your run just the select query, does it return any data?



This query should return the same thing:



SELECT COUNT(*) AS NumberOfRFISent
FROM
Call
INNER JOIN
Event
ON Call.Call_ID = Event.Call_ID
INNER JOIN
CallType ON Call.CallType_ID = CallType.CallType_ID
WHERE [event].[addDate] >= '10/1/2004'
AND [event].[addDate] < '12/1/2004'
AND [anh_Structural_RFI_sent] = - 1
AND CallType.TypeName = 'consumer rep'

0
 
santosh26676Commented:
Tried with the following sql and it works:

create view v1 as
select sum(case when test_id1.id1 = 1 and test_id1.id1 = 2 then 1 else 0 end) as x from test_id1 inner join test_id on test_id1.id1 = test_id.id1
0
 
Taly_lyAuthor Commented:
Thank you nmcdermaid  and santosh26676 .

I tried santosh26676's syntax in my case doesn't work and I don't know why :( . Any way with  nmcdermaid's It works .
 
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now