File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to select last 6 months (names)

 
Jacky Luk
Ranch Hand
Posts: 634
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

how to select last 6 months (names)

select 'VIP' as type, strftime('%m', 'now') AS month


If this month is October,
I want to select
VIP 10
VIP 9
VIP 8
VIP 7
VIP 6
VIP 5
how do I do that?
Thanks
 
Jacky Luk
Ranch Hand
Posts: 634
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a subtable called month
but it can't wrap around for 10-12 months before when this month is 10 etc
if I do
 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks like an operation I'd rather do in Java (or other client language) instead of SQL (if possible, of course).

Perhaps combining the month.month field with current year to obtain an absolute date, and comparing it against a date range computed from the current date would help you manage the wrap-around problem.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic