MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old February 23rd, 2004, 08:43 PM
eternity_patric eternity_patric is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 3 eternity_patric User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Select statement to display entries by month

--------------------------------------------------------------------------------

Hi guys, need some help here. I have a database of entries recorded by date. A filter function is created to allow user to view only entries from a particular month. Say, April, regardless of the year. I've tried this, but yield no result:

query="SELECT * FROM announcement where month LIKE '#Apr#'"
stm=conn.createStatement();
ResultSet rst=stm.executeQuery(query);

The month field is Date/Time

I'm using JSP, the database is MS Access. How should i write the query?

Thanks

Last edited by eternity_patric : February 23rd, 2004 at 09:17 PM.

Reply With Quote
  #2  
Old February 24th, 2004, 08:39 AM
galith_haham galith_haham is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 64 galith_haham User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 25 m 17 sec
Reputation Power: 5
Hi,

try formating the month to the search string:

select 5 from dual where to_char(sysdate,'dd/mon/yyyy') like '%feb%';

or use alter session set nls_date_format=....

that should work.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Select statement to display entries by month


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway