MySQL Forums
Forum List  »  Italian

Re: controllo sequenza
Posted by: Gavin Towey
Date: September 21, 2009 01:15PM

Ci sono due operazioni diverse per controlarli

Prima per numeri doppi prova:

SELECT numeroprotocollo, COUNT(*) AS cnt FROM table GROUP BY numeroprotocollo HAVING cnt >1;

poi per i buchi:

SELECT t1.numeroprotocollo, t2.numeroprotocollo FROM table t1 LEFT JOIN table t2 ON t1.numeroprotocollo=t2.numeroprotocollo-1 WHERE t2.numeroprotocollo IS NULL;

Options: ReplyQuote


Subject
Views
Written By
Posted
4920
August 05, 2009 04:26AM
Re: controllo sequenza
2767
September 21, 2009 01:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.