List:General Discussion« Previous MessageNext Message »
From:Gerald L. Clark Date:October 8 2008 8:43pm
Subject:Re: Finding gaps
View as plain text  
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`
-- 
Gerald L. Clark
Sr. V.P. Development
Supplier Systems Corporation
Unix  since 1982
Linux since 1992
Thread
Finding gapsJerry Schwartz17 Sep
  • Re: Finding gapsStut17 Sep
    • Re: Finding gapsPeter Brawley17 Sep
      • RE: Finding gapsJerry Schwartz8 Oct
        • Re: Finding gapsGerald L. Clark8 Oct
          • RE: Finding gapsUS Data Export8 Oct
        • Re: Finding gapsPeter Brawley8 Oct
          • RE: Finding gapsUS Data Export9 Oct
            • Re: Finding gapsPeter Brawley9 Oct
              • RE: Finding gapsJerry Schwartz10 Oct
                • Re: Finding gapsMoon's Father25 Oct
                  • Re: Finding gapsMoon's Father25 Oct
                  • RE: Finding gapsUS Data Export27 Oct
    • RE: Finding gapsJerry Schwartz17 Sep
      • Re: Finding gapsStut18 Sep
        • Re: Finding gapsMr. Shawn H. Corey18 Sep
        • RE: Finding gapsJerry Schwartz18 Sep
          • Re: Finding gapsMike Diehl18 Sep
            • RE: Finding gapsJerry Schwartz18 Sep
    • RE: Finding gapsMartin Gainty18 Sep
      • RE: Finding gapsJerry Schwartz18 Sep
    • Re: Finding gapsJoerg Bruehe18 Sep
    • Re: Finding gapsJoerg Bruehe18 Sep
      • Re: Finding gapsStut18 Sep
        • Re: Finding gapsMr. Shawn H. Corey18 Sep