Viewing 15 posts - 76 through 90 (of 258 total)
Thanks a lot, the time was messing me up. Corrected that and it works fine.
April 1, 2008 at 9:12 am
That worked. Thanks a lot. Final code
Select ConsultantID
, ConsultantName
, SponsorID
,RecruitCOunt
,AchieveDate
,PurchaseAmount
,Active from #temp1
WHERE Active = 1
UNION ALL
Select t.ConsultantID
, t.ConsultantName
, t.SponsorID
,t.RecruitCOunt
,t.AchieveDate
,SUM(v.PurchaseAmount) AS PurchaseAmount
,t.Active
from #temp1 t
INNER...
March 28, 2008 at 11:10 am
I am trying the UnionStatements:
Select ConsultantID
, ConsultantName
, SponsorID
,RecruitCOunt
,AchieveDate
,PurchaseAmount
,Active from #temp1
WHERE Active = 1
UNION ALL
Select ConsultantID
, ConsultantName
, SponsorID
,RecruitCOunt
,AchieveDate
,PurchaseAmount
,Active from #temp1
UNION ALL
Select t.ConsultantID
, t.ConsultantName
, t.SponsorID
,t.RecruitCOunt
,t.AchieveDate
,SUM(v.PurchaseAmount) AS...
March 28, 2008 at 10:25 am
Where
gci.IssueDate >=@BeginIssueDate
AND gci.IssueDate <= @EndIssueDate
--AND gct.XID = @CertType
and 1 =
case
when @CertType is null then 1
else
case
when gct.XID = @CertType...
March 25, 2008 at 7:13 pm
Thanks for the tip. This is what it turned out to be.
SELECT v.ConsultantID
,SUM(PurchaseAmount) AS PORSalesTotal
,'PORSalesPoints' =
CASE
WHEN SUM(PurchaseAmount) > 15000 And NACDATE <= '06/30/2008' then SUM(PurchaseAmount...
March 25, 2008 at 12:18 pm
There is my duh for the day. That worked great. How would I go about taking the total and then another field assign points to it.
So lets say I have...
March 25, 2008 at 11:11 am
I found out what was going on, it was on my sise so your code is working. But is there a way to use the same code to manipulate more...
March 25, 2008 at 7:54 am
Oops not quite right. Do I need to set up a case statement for each of the filter options?
Where
gci.IssueDate >=@BeginIssueDate
AND gci.IssueDate <= @EndIssueDate
--AND gcv.XID = @VoidREasonFilter
and 1 =...
March 24, 2008 at 3:23 pm
That worked great! I suppressed the NULLS by the following:
Where
gci.IssueDate >=@BeginIssueDate
AND gci.IssueDate <= @EndIssueDate
--AND gcv.XID = @VoidREasonFilter
and 1 = case when @VoidREasonFilter is null then 1 else
...
March 24, 2008 at 1:39 pm
I can go after it this way:
DECLARE @BeginIssueDate Datetime
DECLARE @EndIssueDate DateTime
DECLARE @VoidReasonFilter VARCHAR(50)
SET @BeginIssueDate = '01/01/2008'
SET @EndIssueDate ='04/01/2008'
SET @VoidReasonFilter = 'All Reason Codes'
IF @EndIssueDate > GETDATE()
BEGIN
...
March 24, 2008 at 10:40 am
The code as it sits now:
...
CREATE TABLE #Temp1 (
id_num int IDENTITY(1,1),
COnsultantID char(20),
SponsorID char(20),
RecruitCOunt INT,
AchieveDate DateTime
)
INSERT iNTO #Temp1
Select ConsultantID, SponsorID, COUNT(*)...
March 21, 2008 at 12:38 pm
Believe me I will take that to heart. I kinda got dumped into this because the DBA Developer resigned. So I am trying to get up to speed as quickly...
March 21, 2008 at 9:53 am
That worked fantastic. One of these days I will get this TSQL figured out...
One more quick question. for the column Name (eg. JAN) I would like to format as JAN...
March 21, 2008 at 9:37 am
No I see where the UNION ALL comes in. I think I have an issue with Over-thinking things some time.:D
Declare @MonthsOut int, @StartDate datetime, @EndDate datetime, @COnsultantID char(20)
Set @ConsultantID =...
March 21, 2008 at 9:12 am
OK, I did this:
Select (Select ACtivityDesc FROM #ActivitySummary WHERE ActivitySort = 2) AS ActivtySummary,
Jan = sum(case when month(v.PeriodEndDate) = 1 AND V.consultantID=@consultantID then PurchaseAmount else 0 end),
Feb =...
March 21, 2008 at 9:05 am
Viewing 15 posts - 76 through 90 (of 258 total)