in reply to Difference between dates

Can't this be solved almost entirely within an SQL query?


Dave

Replies are listed 'Best First'.
Re^2: Difference between dates
by aaron_baugher (Curate) on Apr 20, 2015 at 07:56 UTC

    Yes. The OP's code doesn't seem to match his question, since it doesn't do any subtracting, but MySQL can give you the difference between two dates:

    SELECT id, DATEDIFF(lastlogin, dateadded) FROM order_details;

    Aaron B.
    Available for small or large Perl jobs and *nix system administration; see my home node.