Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2009
    Posts
    1

    Unanswered: Sorted this query results

    All,

    I would like to be able to sort the result by nowarranty_date:

    SELECT ord.ship_date, ord.warranty,
    DateAdd("d",[ord].[warranty],[ord].[ship_date]) AS nowarranty_date
    FROM order ord
    ORDER BY DateAdd("d",[ord].[warranty],[ord].[ship_date]);

    Above query will throw an error: "Data Type Mismatch in criteria expression"

    Could anyone tell me what I am missing here?

  2. #2
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580
    ?What is order ord - It this a table name with a space in (naughty!).

    ORDER BY clause looks ok - make sure you havent got any null or erroneous data maybe try;

    SELECT ord.ship_date, ord.warranty,
    DateAdd("d",[ord].[warranty],[ord].[ship_date]) AS nowarranty_date
    FROM order ord

    <If that fails then this might be the problem
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Code:
    SELECT ord.ship_date, ord.warranty,
    DateAdd("d",[ord].[warranty],[ord].[ship_date]) AS nowarranty_date
    FROM ord
    ORDER BY nowarranty_date;
    I'd agree with garethD the Order Ord looks wrong.. I suspect its a typo
    also I see no reason to duolicate the dateadd function in the order by clause
    I think you need to look at the help system for the syntax of the dateadd function, either that or rethink your column naming convention
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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