| List: | General Discussion | « Previous MessageNext Message » | |
| From: | US Data Export | Date: | October 8 2008 8:54pm |
| Subject: | RE: Finding gaps | ||
| View as plain text | |||
>-----Original Message----- >From: Gerald L. Clark [mailto:gerald_clark@stripped] >Sent: Wednesday, October 08, 2008 4:44 PM >To: Jerry Schwartz >Cc: mysql@stripped >Subject: Re: Finding gaps > >Jerry Schwartz wrote: >> I'm finally getting back to this issue, and I've read the bits on >> artfulsoftware. The example >> >> SELECT >> a.id+1 AS 'Missing From', >> MIN(b.id) - 1 AS 'To' >> FROM tbl AS a, tbl AS b >> WHERE a.id < b.id >> GROUP BY a.id >> HAVING a.id < MIN(b.id) - 1; >> >SELECT > a.id+1 AS `Missing_From`, > MIN(b.id) - 1 AS `To` >FROM tbl AS a, tbl AS b >WHERE a.id < b.id >GROUP BY a.id >HAVING a.id < `To` [JS] That didn't seem to work: mysql> SELECT a.prod_num + 1 AS `Missing From`, -> MIN(b.prod_num) - 1 AS `To` -> FROM prod AS a, prod AS b -> WHERE a.prod_num < b.prod_num -> GROUP BY a.prod_num -> HAVING a.prod_num < `To`; ERROR 1054 (42S22): Unknown column 'a.prod_num' in 'having clause'
| Thread | ||
|---|---|---|
| • Finding gaps | Jerry Schwartz | 17 Sep |
| • Re: Finding gaps | Stut | 17 Sep |
| • Re: Finding gaps | Peter Brawley | 17 Sep |
| • RE: Finding gaps | Jerry Schwartz | 8 Oct |
| • Re: Finding gaps | Gerald L. Clark | 8 Oct |
| • RE: Finding gaps | US Data Export | 8 Oct |
| • Re: Finding gaps | Peter Brawley | 8 Oct |
| • RE: Finding gaps | US Data Export | 9 Oct |
| • Re: Finding gaps | Peter Brawley | 9 Oct |
| • RE: Finding gaps | Jerry Schwartz | 10 Oct |
| • Re: Finding gaps | Moon's Father | 25 Oct |
| • Re: Finding gaps | Moon's Father | 25 Oct |
| • RE: Finding gaps | US Data Export | 27 Oct |
| • RE: Finding gaps | Jerry Schwartz | 17 Sep |
| • Re: Finding gaps | Stut | 18 Sep |
| • Re: Finding gaps | Mr. Shawn H. Corey | 18 Sep |
| • RE: Finding gaps | Jerry Schwartz | 18 Sep |
| • Re: Finding gaps | Mike Diehl | 18 Sep |
| • RE: Finding gaps | Jerry Schwartz | 18 Sep |
| • RE: Finding gaps | Martin Gainty | 18 Sep |
| • RE: Finding gaps | Jerry Schwartz | 18 Sep |
| • Re: Finding gaps | Joerg Bruehe | 18 Sep |
| • Re: Finding gaps | Joerg Bruehe | 18 Sep |
| • Re: Finding gaps | Stut | 18 Sep |
| • Re: Finding gaps | Mr. Shawn H. Corey | 18 Sep |
