Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL 2000 Query

SQL 2000 Query

Scheduled Pinned Locked Moved Database
database
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CodingYoshi
    wrote on last edited by
    #1

    I have a table with these fields: Season      Day         DateStart         DateEnd         WeekNumber         MonthNumber         MonthName         Year S               Sunday      2/1/2009         2/1/2009         1                        1                        February            2009 F               Saturday   1/31/2009         1/31/2009      53                     12                        January            2009 . . . This is a daily fiscal calendar. I need to get the season, Day the season started, Date of the season start, Date of the season end, week number of season start, month name of season start, and the year of season start. Because this is daily calendar I am thinking I can get the MIN(DateStart), and WeekNumber grouped by WeekNumber and year. Season   Date_Start Week_Number Month_Number      Month                  Year S     2001-01-28     1     1                 February        2001 S     2002-01-27      1     1                 February        2002 S     2003-01-26      1     1                 February        2003 S     2004-02-01      1     1   &nb

    S 1 Reply Last reply
    0
    • C CodingYoshi

      I have a table with these fields: Season      Day         DateStart         DateEnd         WeekNumber         MonthNumber         MonthName         Year S               Sunday      2/1/2009         2/1/2009         1                        1                        February            2009 F               Saturday   1/31/2009         1/31/2009      53                     12                        January            2009 . . . This is a daily fiscal calendar. I need to get the season, Day the season started, Date of the season start, Date of the season end, week number of season start, month name of season start, and the year of season start. Because this is daily calendar I am thinking I can get the MIN(DateStart), and WeekNumber grouped by WeekNumber and year. Season   Date_Start Week_Number Month_Number      Month                  Year S     2001-01-28     1     1                 February        2001 S     2002-01-27      1     1                 February        2002 S     2003-01-26      1     1                 February        2003 S     2004-02-01      1     1   &nb

      S Offline
      S Offline
      Syed Mehroz Alam
      wrote on last edited by
      #2

      Hi, Looking at your data, it seems that you have a single entry per year in both the min and max result sets. If so, you can use derived tables, something like:

      Select ...
      From
      (
      --your first (min) query
      ) as SeasonStart
      Inner Join
      (
      --your second (max) query
      ) as SeasonEnd
      on SeasonStart.Year = SeasonEnd.Year

      Hope that helps. Regards,

      Syed Mehroz Alam My Blog | My Articles
      Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

      C 1 Reply Last reply
      0
      • S Syed Mehroz Alam

        Hi, Looking at your data, it seems that you have a single entry per year in both the min and max result sets. If so, you can use derived tables, something like:

        Select ...
        From
        (
        --your first (min) query
        ) as SeasonStart
        Inner Join
        (
        --your second (max) query
        ) as SeasonEnd
        on SeasonStart.Year = SeasonEnd.Year

        Hope that helps. Regards,

        Syed Mehroz Alam My Blog | My Articles
        Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

        C Offline
        C Offline
        CodingYoshi
        wrote on last edited by
        #3

        No, that won't work because some fall seasons start in one year but end in a different year so the join won't work. Any other ideas?

        CodingYoshi Artificial Intelligence is no match for Human Stupidity.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups