Forum Replies Created

Viewing 15 posts - 241 through 255 (of 258 total)

  • RE: Return a single row per

    That did it.

    Final code took this shape I di d use your function.

    WITH ALevel (ConsultantID, AchieveLevel, AchieveTitle, PeriodEnddate) AS

    (

    SELECT ConsultantID, max(AchieveLevel), AchieveTitle, PeriodEndDate AS DirectReports

    ...

  • RE: Using WITH CTE

    That's the issue. I can do it if I just wanted distinct AchieveLevels but that is not the case. I need one record for each change in AchieveLevel.

  • RE: Return a single row per

    The consultantID is the unique identifier.

  • RE: Return a single row per

    Anybody have any thoughts on this? I am really stuck!

  • RE: Return a single row per

    There seems to be something missing:

    selectachievetitle

    ,achieveLevel

    ,max(periodenddate) AS PeriodEndDate

    from Volume

    where ConsultantID = @ConsultantID

    GROUP BY AchieveTitle

    ,AChievelevel

    order by periodenddate

    This returns

    NAC Consultant01 2001-05-31 00:00:00.000

    Consultant 02 2002-04-30 00:00:00.000

    Team Manager...

  • RE: Return a single row per

    That last one was the ticket. Thanks.

  • RE: Return a single row per

    This is really close:

    select achievetitle,achieveLevel, max(periodenddate)

    from Volume where ConsultantID = '0000288'

    GROUP BY AchieveTitle, AChievelevel

    But it needs to appear in PeriodEndate order but when I put a group by on with...

  • RE: Help on UDF

    I think I solved my issue: Final code:

    SELECT A.ConsultantID

    ,A.EffectiveDate

    ,A.FirstName + ' ' + A.LastName as ConsultantName

    ,A.BillToFirstName + ' ' + A.BillToLastName as BillToName

    ,BillToAddressLine1

    ,BillToAddressLine2

    ,BillToCity

    ,BillToState

    ,BillToZip

    ,BillToPhone

    ,A.ShiptoFirstName + ' ' + A.ShipToLastName as ShipToName

    ...

  • RE: Help on UDF

    This is the code that I am currently working with.

    DECLARE@ConsultantIDASnVarChar(50)

    ,@PeriodDateASDateTime

    SET @ConsultantID = '0000344'

    SET @PeriodDate = '2007-12-03 11:26:44.263'

    SELECT A.ConsultantID

    ,A.EffectiveDate

    ,A.FirstName + ' ' + A.LastName AS ConsultantName

    ,A.SponsorID

    ,(SELECT DISTINCT ...

  • RE: Help on UDF

    part of the issue is that the consultant table has multiple records for a given consultant (it's not a one to one). Also we are passing in the consultantID.

  • RE: Tuning a Recursive Query

    You are so correct, I looked at the query plan and found I was missing few indexes, which I appl;ied and now its a speedy proc.

    Thanks

  • RE: Case, IF or something different

    It would be along these lines:

    ConID PeriodEndDate ...

  • RE: Case, IF or something different

    I think that will work for the initial view which I just need to indicate that a person has had a least one re-promote in their history. The trick will...

  • RE: Case, IF or something different

    I was just told that the criteria changed:

    It's only to be flagged if they go to a lower level then back up to the same level so in this case...

  • RE: Case, IF or something different

    Thank you, that was it. You nailed it. Thank you:D

Viewing 15 posts - 241 through 255 (of 258 total)