Flagging consecutive days in SQL
<p>I have a table that looks something like this</p>

<pre><code>PATIENT_ID    DATE_NOTED
1             01/01/2015 06:39
1             01/01/2015 17:15
1             01/02/2015 04:30
2             01/01/2015 07:34
2             01/03/2015 18:16
</code></pre>

<p>The dates in the table represent the times wheezing was recorded in the patient's record. I'm trying to flag patients who have at least one instance of at least two consecutive days of wheezing recorded, so a result table would look something like this:</p>

<pre><code>PATIENT_ID    CONSECUTIVE
1             Yes
2             No
</code></pre>

<p>Patient 1 had wheezing recorded on 01/01/2015 and 01/02/2015, so they would be flagged yes. Patient 2 had wheezing recorded on 01/01/2015 and 01/03/2015, so they would be flagged no. I played around with row_number() a bit, but I can't figure out how to code this. I'm using Netezza.</p>