Maximo Open Forum

 View Only
  • 1.  Date query help

    Posted 02-04-2022 08:14

    I am on DB2, Sorry, should have included that!

     



  • 2.  RE: Date query help

    Posted 02-07-2022 10:08
    Edited by Matt McGuire 02-07-2022 10:14
    Hi David,

    What are you trying to query? Below are partial queries we're using:

    1. WOTRACK: You want to find all work orders since January 1st

    actfinish >= '2022-01-01 04:00:00.000'

    2. PM: PMs due in the next 60 days

    nextdate <= current date + 60 days

    Thanks,

    ------------------------------
    Matt McGuire
    Aquitas Solutions
    https://www.aquitas-solutions.com/
    ------------------------------



  • 3.  RE: Date query help

    Posted 02-08-2022 10:38
    Hi Matt,

    What is the syntax for "PM: PMs due in the next 60 days" in SQL server?

    Thanks



    ------------------------------
    StevieHollowayTufts University
    ------------------------------



  • 4.  RE: Date query help

    Posted 02-08-2022 10:44
    Hi Stevie,

    The syntax above is for use in a DB2 environment. If you're in DB2 you can copy that directly into the PM application Where Clause and find your PMs with an Earliest Next Due Date (NEXTDATE) within 60 days.

    Please let me know if that helps.

    Thanks,

    ------------------------------
    Matt McGuire
    Aquitas Solutions
    https://www.aquitas-solutions.com/
    ------------------------------



  • 5.  RE: Date query help

    Posted 02-08-2022 10:51
    Hi,

    I'm asking for the same query for SQL Server.

    Stevie

    ------------------------------
    Stevie Holloway
    Tufts University
    ------------------------------



  • 6.  RE: Date query help

    Posted 02-08-2022 11:40

    I don't have a SQL Server environment to test this on right now but you should be able to do something like this:

    nextdate <= CAST(getdate() as date) + 60

    getdate() has the current date and time and next date is just a date only field so we first cast it to a date to drop the time aspect. SQL Server allows you to simply add the number of days to a date so we just say +60. There are other ways to do it but this is the simplest IMO. 



    ------------------------------
    Steven Shull
    IBM
    ------------------------------