Ok I probably know how to do this (in the back of my head) but can't seem to just get it constructed.
Here is the database table i'm working with (named products):
id - primary key, auto increment
title - text, title of product
rd - date, date product will be released
rd_type - smallint(1), type of release date (real date, quarter: ex. Q4 2004)
quarter - text, quarter release date (ex. Q4 2004, Q2 2006)
id|title|rd|rd_type|quarter
This script is basically to list products coming out this year. I'd like to do this, list all the products that have a real date (where rd_type = 1) first, then ones with a quarter date (where rd_type = 2). And the main thing is, products whose release date is before the current date, cannot be displayed, so if a product is to be released on May 11, 2004, and the current date is May 12, 2004, it will not show up.
For the real dates, I'd like to do it like:
June 2004
- Product 1
- Product 2
July 2004
- Product 3
- Product 4
and lets make believe there are no products for this year after July, so we continue on to next year:
January 2005
- Blah..
Then the quarter dates
Q1 2004
- Product
Q2 2004
- Product
Q3 2004
- Product
lets pretend there is nothing for Q4 2004, then we start listing for Q1 2005 and so on.
I will probably do this in two seperate queryies but my problem is I can't figure out how to get it to list how I want it to. I realize this is probably something complicated but please, help if you can. Thank you for your time.