28. April 2011 11:36
SELECT FilteredIncident.incidentid, FilteredIncident.statecode, FilteredIncident.statuscode, FilteredIncident.ticketnumber, FilteredIncident.title,
FilteredIncident.new_companyid, FilteredIncident.casetypecode, FilteredIncident.casetypecodename, FilteredIncident.statecodename, Count(FilteredIncident.incidentid) as allIncidents
FROM FilteredAccount INNER JOIN
FilteredIncident ON FilteredAccount.accountid = FilteredIncident.new_companyid
WHERE (FilteredIncident.new_companyid = @accountid)
Die FilteredIncident.incidentid-Spalte ist in der Auswahlliste ungültig, da sie nicht in einer Aggregatfunktion und nicht in der GROUP BY-Klausel enthalten ist.
28. April 2011 17:58
SELECT FilteredIncident.incidentid, FilteredIncident.statecode, FilteredIncident.statuscode, FilteredIncident.ticketnumber, FilteredIncident.title,
FilteredIncident.new_companyid, FilteredIncident.casetypecode, FilteredIncident.casetypecodename, FilteredIncident.statecodename, Count(FilteredIncident.incidentid) as allIncidents
FROM FilteredAccount INNER JOIN
FilteredIncident ON FilteredAccount.accountid = FilteredIncident.new_companyid
WHERE (FilteredIncident.new_companyid = @accountid)
GROUP BY FilteredIncident.incidentid
29. April 2011 15:14
SELECT COUNT(FilteredIncident_1.incidentid) AS allIncidents,
(SELECT COUNT(incidentid) AS Expr1
FROM FilteredIncident
WHERE (statecode = 1) AND (new_companyid = @accountid)) AS closedIncidents,
(SELECT COUNT(incidentid) AS Expr1
FROM FilteredIncident AS FilteredIncident_9
WHERE (statecode = 0) AND (new_companyid = @accountid)) AS activeIncidents,
(SELECT COUNT(incidentid) AS Expr1
FROM FilteredIncident AS FilteredIncident_8
WHERE (statecode = 2) AND (new_companyid = @accountid)) AS canceledIncidents,
(SELECT COUNT(DISTINCT customeridname) AS Expr1
FROM FilteredIncident AS FilteredIncident_7
WHERE (new_companyid = @accountid)) AS numberofContacts,
(SELECT COUNT(incidentid) AS Expr1
FROM FilteredIncident AS FilteredIncident_6
WHERE (new_companyid = @accountid) AND (DATEDIFF(m, createdon, GETDATE()) <= @period)) AS allCasesInPeriod,
(SELECT COUNT(incidentid) AS Expr1
FROM FilteredIncident AS FilteredIncident_5
WHERE (statecode = 1) AND (new_companyid = @accountid) AND (DATEDIFF(m, createdon, GETDATE()) <= @period)) AS closedCasesInPeriod,
(SELECT COUNT(incidentid) AS Expr1
FROM FilteredIncident AS FilteredIncident_4
WHERE (statecode = 0) AND (new_companyid = @accountid) AND (DATEDIFF(m, createdon, GETDATE()) <= @period)) AS activeCasesInPeriod,
(SELECT COUNT(incidentid) AS Expr1
FROM FilteredIncident AS FilteredIncident_3
WHERE (statecode = 2) AND (new_companyid = @accountid) AND (DATEDIFF(m, createdon, GETDATE()) <= @period)) AS canceledCasesInPeriod,
(SELECT COUNT(DISTINCT customeridname) AS Expr1
FROM FilteredIncident AS FilteredIncident_2
WHERE (new_companyid = @accountid) AND (DATEDIFF(m, createdon, GETDATE()) <= @period)) AS numberofContactsInPeriod
FROM FilteredAccount INNER JOIN
FilteredIncident AS FilteredIncident_1 ON FilteredAccount.accountid = FilteredIncident_1.new_companyid
WHERE (FilteredIncident_1.new_companyid = @accountid)
6. Mai 2011 00:48
6. Mai 2011 15:33