Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    24

    Unanswered: Problems outputing field from query

    Hi im using SQL2000 as a backend DB

    When running this query the Month field is not being outputted

    SELECT (MONTH(msg.ts)) AS 'MonthSort',
    (DATENAME(mm,msg.ts) + ' ' + DATENAME(yy,msg.ts)) AS 'Month',
    COUNT(msg.ts) as 'Count'
    FROM msg
    WHERE msg.op_id = 1
    GROUP BY (DATENAME(mm,msg.ts) + ' ' + DATENAME(yy,msg.ts)),
    (MONTH(msg.ts))
    ORDER BY 'MonthSort' ASC


    has anyone got any ideas?????

  2. #2
    Join Date
    Jan 2004
    Posts
    184

    Re: Problems outputing field from query

    Please give a sample value of msg.ts to be able to answer.
    In abundance of water only the fool is thirsty. Bob Marley.

  3. #3
    Join Date
    Feb 2004
    Posts
    24

    Re: Problems outputing field from query

    example of msg.ts would be

    '23/02/2004 15:25:12' as a datetime field in SQL2000

  4. #4
    Join Date
    Jan 2004
    Posts
    184

    Re: Problems outputing field from query

    The problem is that SQL is looking for a datetime in the MM/DD/YYYY format however you are sending a DD/MM/YYYY format. Once you make the change your query should work.

    http://www.geocities.com/scirocco_ha/DataControl.htm
    In abundance of water only the fool is thirsty. Bob Marley.

Posting Permissions

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