I have a table orders that keeps all order from all our stores. I wrote a query to check the sequence orders for each store. It looks like that.
select WebStoreID, min(webordernumber), max(webordernumber), count(webordernumber)
from orders
where ordertype = 'WEB'
group by WebStoreID
I can check it all orders are present with this query. web ordernumber is number from 1...n.
How can I write query to find missing orders without joining to temporary/different table?