How will you find last sunday of a month in sql 2000?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
An alternative approach, borrowed from data warehousing practice. Create a date-dimension table and pre-load it for 10 years, or so.
The easiest way to fill-in the
dimDate
is to spend an afternoon with Excel and then import to DB from there. A half-decentdimDate
table has 50+ columns -- anything you ever wanted to know about a date.With this in place, the question becomes something like:
Essentially, all date related queries become simpler.