金融保險 » Rambler Channel 登入 註冊 推介網誌 行業分類 人氣榜 最新記事

SQL - consecutive_days

select name, min(reportDate) startDate, max(reportDate) endDate
from (
  select a.name, a.reportDate, count(*) as ct
  from reportStuff a, reportStuff b
  where a.reportDate >= b.reportDate
  and a.name = b.name
  group by a.name, a.reportDate
) t
group by name, reportDate - ct

SQL - top 20 records

SELECT
-- Columns
      FIELD
-- Tables
      FROM LIB/FILEX AS A
-- Where
      WHERE 19 >=
            ( SELECT COUNT(*)
              FROM LIB/FILEX AS B
              WHERE B.FIELD_COUNT > A.FIELD_COUNT
                AND A.KEY1 = B.KEY1
                AND A.KEY2 = B.KEY2

dance

http://www.youtube.com/watch?v=vyHUzJPNIXs&feature=related

Pay Days 2009

24 July 2009 (Friday)
24 August 2009 (Monday)

24 September 2009 (Thursday)
23 October 2009 (Friday)
24 November 2009 (Tuesday)
21 December 2009 (Monday)
«上一頁   1 2 3