Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2011
    Posts
    78

    Unanswered: Selecting month out of date

    I wanted to use castmonth to filter the data to only show data for 06 which is june. However, the castmonth column has values like 201106, 201107 (a combination of year and month)

    Please help, thank you.





    Code:
    select 
            [IDETAIL].[RCODE]
           ,[IDETAIL].[CASTMONTH]
           ,[IDETAIL].[VSTATUS]
           ,[CONTRACT].[ANAME]
           ,[CONTRACT].[AOFFICECODE]
          
           
           FROM [Opt].[EDA4010].[I_DETAIL] as invoice_detail
           
          inner 
           
           join [Opt].[EDA4010].[CONTRACT] as contract 
           
           on [contract].[CNUMBER]=[I_DETAIL]. [CNUMBER]
           
           where [CASTMONTH]=201106

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    If castmonth is an integer, then castmonth % 100,
    if it is a string, then right(castmonth, 2).

  3. #3
    Join Date
    Jul 2011
    Posts
    78
    Thank you so much for your reply

Posting Permissions

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