>Is there a quick method of selecting records where only a single instance of the order number exists?
>
>I have a situation where we want to fill orders where only 1 certain item was ordered. If the order has more than this one item, we want to wait until we can ship the order complete.
>
>I think that a SELECT DISTINCT will return the order number of all orders which contain that item, whether or not multiple items exist for the order. We don't want that.
>
>The only other process I have envisioned is to loop through and check for other items having the same order number and discard the record if they exist.
>
>Am I on the right track, or is there a simpler way?
>
>Thanks,
>
>Neil Preston
SELECT COUNT(*), OrderID FROM Mytable GROUP BY OrderID HAVING COUNT(*) = 1
Erik Moore
Clientelligence