Forum Replies Created

Viewing 15 posts - 16 through 30 (of 45 total)

  • RE: Table Function question

    Thanks Jeff. I will look into the cross-apply solution. I always learn something new when I'm here 🙂

  • RE: Table Function question

    Thanks, I was hoping there would be some kind of loop (beyond my level) or something that could iterate through each account.

    Ideally, I'd like to avoid creating a duplicate query...

  • RE: Date Range Calculation Challenge

    Lowell (2/3/2015)


    i might be reading the question too simply;

    can you just sum up the differences btween the two dates?

    --days

    /*--Results

    account loc (No column name)

    1 ...

  • RE: Forecasting Problem

    Excellent, thank you.

  • RE: Forecasting Problem

    This is beautiful. Thank you very much.

    I was trying with a case like you did, but without success. I am curious about this piece of your code:

    CASE WHEN...

  • RE: Forecasting Problem

    Thanks for your reply, I appreciate you taking the time to help with this.

    After testing your query with a few different scenarios, I came across a slight problem. I...

  • RE: Random account selection for each staff person

    Looks like I just figured out my own problem. Here's my solution. Just closing the loop.

    SELECT staffid,account FROM

    (select

    ROW_NUMBER() OVER(PARTITION BY staffid ORDER BY newid() ) AS RowID

    ,...

  • RE: Can DatabaseMail attach a formatted Excel file?

    charu.verma (12/1/2009)


    Hi

    As per above suggestions, I tried to use tab as a query separator but still all the query data is coming in the same column..Is there something that I...

  • RE: How do I return the third Friday of the current month?

    Thanks for both of your responses.

    Lowell, thanks for the explanation. Made sense when you put it so simply.

  • RE: query with multiple parameters

    true, pivot table may be the way to go. thanks.

  • RE: Date range problem

    Great thankyou, works perfectly. Always so simple once you see the solution.

    noeld (11/18/2008)


    DECLARE @account int, @from datetime, @to datetime

    select @account = 1 , @from...

  • RE: Selecting the one most recent rating from each grouping and comparing it to the second most recent rating

    Great thank you. This works perfectly.

    Chris Harshman (10/16/2008)


    Probably the easiest way to write this would be to use a combination of the ROW_NUMBER function to determine how recent each...

  • RE: COUNT problem

    thank you for the detailed response, I really appreciate it. Very informative I had thought about a temporary table also but your explanation clarified exactly how to do...

  • RE: COUNT problem

    thank you; this gave me exactly what I need

    Zahran (7/29/2008)


    Try this,

    SELECT COUNT(ACCOUNT) FROM

    (SELECT COUNT(DISTINCT ACCOUNT) AS ACCOUNT

    FROM dxhistory

    WHERE RANK=1

    GROUP BY ACCOUNT, RANK

    HAVING COUNT(RANK)>1)AS T

  • RE: COUNT problem

    this returns rows of 1's

    Zahran (7/29/2008)


    You can use this query too...

    SELECT

    COUNT (DISTINCT ACCOUNT)

    FROM dxhistory

    WHERE RANK=1

    GROUP BY ACCOUNT, RANK

    HAVING COUNT(RANK)>1

Viewing 15 posts - 16 through 30 (of 45 total)