So let's say I have a table Orders with columns: Order# and ReceiptDate. Order#'s may be duplicated (Could have same Order# with different ReceiptDate). I want to select Order#'s that go back 6 months from the last ReceiptDate for each Order#. I can't just do something like:SELECT * FROM OrdersWHERE ReceiptDate >= add_months(date,-6) because there could be Order#'s whose last ReceiptDate was earlier than 6 months ago. I want to capture all of the instances of each Order# going back 6 months from each last ReceiptDate relative to each Order#.I am unsure of how to this in the most efficient way. I am a new user so I apologize if this question seems like a bad one. Thanks
↧