In my table, I have Collection_Date and Tag_Date fields, both of type date.
I need to query this table, separating each date into its component month, day, and year, but still keeping the distinction between the Collection_Date dates and the Tag_Date dates, and I don't want duplicates.
I tried this:
SELECT DISTINCT
MONTH(Collection_Date) AS col_month,
DAY(Collection_Date) AS col_day,
YEAR(Collection_Date) AS col_year,
MONTH(Tag_Date) AS tag_month,
DAY(Tag_Date) AS tag_day,
YEAR(Tag_Date) AS tag_year
FROM the_table
However, this only returns rows with a unique Collection_Date and Tag_Date.
What I think I want is to separate it into two queries, one SELECT DISTINCTing Collection_Date and one for Tag_Date. However, I would really like to avoid multiple queries, if possible.
How can I accomplish this?