Subtracting date fields

2003-12-31 Thread Kenneth Letendre
Hello, I'm trying to get the difference (in days) between dates stored in two date fields. My query: SELECT id,(firstdate- postdate) AS diff FROM calendar This works fine if the two dates are in the same month, but not otherwise. MySQL appears to be treating the two dates as base-10 int

Subtracting date fields

2003-12-31 Thread Kenneth Letendre
Hello, I'm trying to get the difference (in days) between dates stored in two date fields. My query: SELECT id,(firstdate- postdate) AS diff FROM calendar This works fine if the two dates are in the same month, but not otherwise. MySQL appears to be treating the two dates as base-10 int

SELECT DISTINCT on two columns

2001-05-18 Thread Kenneth Letendre
I have two columns in a table I need to get distinct values out of. I know I can get distinct combinations of the values of the two columns with "SELECT DISTINCT fruits1, fruits2" but what I need is unique values among the two. So that if in fruits1 I have values "apples" and "oranges", an