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
Edit: A correct, final, working answer from my colleague.
Next sunday in SQL, regardless which day is first day of week: returns 2011-01-02 23:59:59.000 on 22-dec-2010:
Holy cow, this is ugly, but here goes:
First built a tally table. http://www.sqlservercentral.com/articles/T-SQL/62867/ then get what you want..
http://www.sqlservercentral.com/Forums/Topic515226-1291-1.aspx
I find some of these solutions hard to understand so here's my version with variables to explain the steps.