SQL Date Help Again

Results 1 to 2 of 2

Thread: SQL Date Help Again

  1. #1
    Join Date
    Dec 1969

    Default SQL Date Help Again

    Here is what I am trying to do:<BR><BR>Given a month number (ie 1 for January), find the season where this month lies and get the records for that season. My only problem is, when I am given 1, for winter, how do I compare that for the months between 12 and 2. It always thinks that 1 is less then 12 and I need it to go the other way?

  2. #2
    Javier S. Guest

    Default RE: SQL Date Help Again

    One approach could be to shift "the month number 12" using the MOD operator.<BR>I mean: <BR>NewValue=MonthNumber mod 12 <BR> then compare the newvalue to 0, 1 or 2 for winter, 3, 4 or 5 for spring....<BR>Hope you find it useful.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts