Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Jeffrey04

By: a guest on Aug 26th, 2008  |  syntax: SQL  |  size: 0.22 KB  |  views: 151  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SELECT  COUNT(*) AS total_days
  2. FROM    (SELECT date '2008-8-26' + generate_series(0, (date '2008-9-1' - date '2008-8-26')) AS all_days) AS calendar
  3. WHERE   EXTRACT(isodow FROM all_days) < 6;
  4. -- based on http://pastebin.com/m4c143e84