Forum Moderators: open
If I have dates column and a "published" column, such as:
date, published
1911-04-26, y
1855-10-16, y
1941-10-20, y
1998-10-27, n
2004-10-27, n
Can I make a mysql query to get all the matches for the month, regardless of the year?
SELECT * FROM table WHERE date BETWEEN 'October-01' AND 'October-31'
Also, can I combine two queries into one super query? Such as:
SELECT * FROM table WHERE (published='y' AND date BETWEEN 'October-01' AND 'October-31') OR (published='n' AND date BETWEEN '1998-10-01' AND '1998-10-31') SORT BY date
Note on this demo combined query it searches the same table but years don't matter if published='y' where it does if published='n'.