I am trying to write an SQL query that shows STORES that stopped ordering in a month. That would be STORES that have orders the month before but no orders that month. For example STORES that have orders in January but do Not have orders in Febuary (these would be the STORES that stopped ordering for Febuary). I want to do this for every month (grouped) for a given date range - @datefrom-@dateto

I have one table with an INVOICE#,STORE# and a DATE column

I guess distinct STORE would be in there somewhere.