|
gschwab
Starting Member
3 Posts |
Posted - 03/08/2013 : 12:35:47
|
I'm trying to create a graph that lists the number of claims entered in the past 6 months. The graph works fine, but the months are not in order. I've tried to make if sort in Visual Studio with no luck. The frustrating thing is that sometimes the months are in order, but most of the the are just randomly sorted. Any idea how I can sort it in either my stored procedure or maybe an expression in Visual Studio? Thanks!
ALTER PROCEDURE [dbo].[Report_Select_NewClaimants_Graph2] ( @InsurerID INT, @DateFrom DATETIME, @DateTo DATETIME, @xClaimantStatusID VARCHAR(20) )
AS
BEGIN SET NOCOUNT ON
SELECT cl.ClaimantID, ct.ClaimantTypeDesc, DATENAME(MONTH,c.EntryDate) AS MonthNames, YEAR(c.EntryDate) AS Years FROM dbo.Claimant cl (NOLOCK) INNER JOIN dbo.Claim c (NOLOCK) ON cl.ClaimID = c.ClaimID INNER JOIN dbo.ClaimantType ct ON cl.ClaimantTypeID = ct.ClaimantTypeID INNER JOIN Policy p (NOLOCK) ON c.policyid = p.policyid WHERE p.insurerid = @InsurerID AND c.EntryDate BETWEEN DATEADD(MONTH, -6, @DateTo) AND @DateTo AND cl.ClaimantStatusID IN (select * from dbo.list_to_tbl(@xClaimantStatusID)) AND cl.ClaimantTypeID NOT IN(1,7,8,9,12,13)
SET NOCOUNT OFF END |
|