Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2014
    Posts
    1

    Unanswered: return count of customers per branch

    i have a table in oracle called returns which has the following fields: ref_no, period, date_created, customer. i need a query that will return the number of customers who filed the latest return(ref_no) for a given period.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    > i need a query that will return the number of customers who filed the latest return(ref_no) for a given period.

    count = 1; since there can be only single latest return(ref_no) for each period
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jul 2013
    Posts
    11
    Hi,

    I agree with the previous reply . If ref_no is a unique column then the count of customer will always be 1 for any latest ref_no @ any point of time.

    Can you please elaborate your requirement with a use case?

    Regards,
    Supreeth

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Can you please elaborate your requirement with a use case?
    I hope you to provide an example by
    (1) CREATE TABLE statement, like
    Code:
    CREATE TABLE returns
    ( ref_no       NUMBER?
    , period       ?
    , date_created DATE?
    , customer     VARCHAR2?
    )
    (2) Populate sample data by
    Code:
    INSERT INTO returns VALUES (...);
    INSERT INTO returns VALUES (...);
    ...
    (3) Expected/required results from (1) and (2).

  5. #5
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Talking

    tonkuma,
    In order to:
    return count of customers per branch
    The said branches are secret as they do not appear in the list of columns.
    Therefore you may need a crystal ball left-joined to a ouigi board in order to prophesy a somewhat obscure result.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  6. #6
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    I couldn't find the statement
    return count of customers per branch
    in original post.
    (But, that was the title of this thread. And, it made me some confusions.)

    OP wrote
    ... i need a query that will return the number of customers who filed the latest return(ref_no) for a given period.
    Last edited by tonkuma; 01-07-14 at 17:40. Reason: Added "(But, that was the title of this thread. And, ...)"

  7. #7
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Talking

    Quote Originally Posted by tonkuma View Post
    I couldn't find the statement in original post.
    (But, that was the title of this thread. And, it made me some confusions.)
    Which validates the need of some external help to figure it out.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •