Looking for a specific record number

  • Hello - I am writing a stored procedure where I am returning all transactions in a month. Each record returns a TransactionNo and a CustomerNo. For each record I want to see if this customer has other records outside the current month - and I want to see the customer's transaction record before the one that is in this month.

    Hopefully I am making sense.

    Thanks in Advance.

  • The best way to do this is to read and follow the instructions in the first article I reference below in my signature block regarding asking for assistance.

    If you follow those instructs, plus include the expected results, people will trip over each other to help you out. From your simple word description it is hard to tell what you really need.

    Plus, you will get tested code in return.

  • It depends upon the table structure that you use to store Transactions of Current Month and Last Months. As said above, plz post the sample data and structure.

    From your description it seems quite simple. Get the transaction from the current month of the Customer and write a correlated sub-query to get the transaction number from the Last Month Table.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply