ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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:
  #1  
Old September 11th, 2003, 04:14 PM
spackbace spackbace is offline
graphics monkey
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Georgia Tech, Atlanta, GA
Posts: 71 spackbace User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 21 sec
Reputation Power: 7
Send a message via AIM to spackbace
selecting only records from specific month (ASP & MSSQL)

I am having trouble coming up with the correct SELECT statement to use when I only want to select the records from a certain month. In this case, the current month. In my database all the date records are in this format:

MM/DD/YYYY HH:MMAM

I figured out what "this" month is by doing the following:

thisMonth = split(now, "/")

so thisMonth(0) will give me the numerical value for this month. In todays case, its 9.

I am then trying to select all records from my database that have their date field starting with the number 9. Here's what I'm trying:

"select hitDate from hits where hitDate like '%" & thismonth(0) & "/%/2003%' order by hitDate"

But this is not working. It keeps returning 0 results. Anyone know what i'm doing wrong, or better yet, a proper way to do what I'm trying to do?
__________________
Brian

Reply With Quote
  #2  
Old September 11th, 2003, 05:14 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,798 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 15 h 20 m 18 sec
Reputation Power: 746
I usually use BETWEEN

SELECT stuff FROM table WHERE datefield BETWEEN '5/1/2003' AND '6/1/2003'

Reply With Quote
  #3  
Old September 11th, 2003, 05:28 PM
spackbace spackbace is offline
graphics monkey
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Georgia Tech, Atlanta, GA
Posts: 71 spackbace User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 52 m 21 sec
Reputation Power: 7
Send a message via AIM to spackbace
thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > selecting only records from specific month (ASP & MSSQL)


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