ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion 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:
  #1  
Old April 22nd, 2005, 02:41 PM
jbird4k jbird4k is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Maryland
Posts: 54 jbird4k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 40 m 18 sec
Reputation Power: 7
Send a message via ICQ to jbird4k Send a message via Yahoo to jbird4k
Date manipulation problems - returns do data

Hi, I have the following query which works perfectly. It returns a single row of data for each staff member who has entered hours in the database, the hours are returned a sum of Hours for that user.

Code:
SELECT tblStaff.staffFname, tblStaff.staffLname, sum(tblTMDATA.hrs) as sHrs
 FROM tblStaff, tblTMDATA 
WHERE tblStaff.staffID=tblTMDATA.staffID 
GROUP BY tblStaff.staffFname, 
tblStaff.staffLname 
ORDER BY tblStaff.staffLname, tblStaff.staffFname 


Now I need to break this down and show it weekly (Friday - thursday) and monthly.


tblTMDATA contains a date field however if i try to do anything with the date field say add " and wkEndingDTD = 4/22/2005" to the where clause, it brings back 0 records it should return 5 records.

If I add it to the select, where, and group by it returns 1 record.

Any ideas?

my ultimate goal is to show the total hours grouped by staffmember ( john doe 40 ) for the week. with week defined as friday - thursday.

And to show the total hours grouped by stafff member for the calendar month (john Doe 120 ) Second part is a separate query. But this is my goal
__________________
J. Birdsell,
www.carry-on-scheff-fans.com

Reply With Quote
  #2  
Old April 22nd, 2005, 03:57 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
What database are you using?
MySQL? MS SQL? Oracle?

" and wkEndingDTD = 4/22/2005"
shouldn't really return any records because it's an actual date according to how dates are structured since all dates have a time attached to them (in your case, it most likely always be 12:00:00 AM). Try this:
" and wkEndingDTD LIKE '%4/22/2005%'"

Reply With Quote
  #3  
Old April 22nd, 2005, 06:54 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,676 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 10 m 34 sec
Reputation Power: 53
Try using the ODBC date format:

and wkEndingDTD = #createODBCDate( '4/22/2005' )#
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #4  
Old April 25th, 2005, 07:57 AM
jbird4k jbird4k is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Maryland
Posts: 54 jbird4k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 40 m 18 sec
Reputation Power: 7
Send a message via ICQ to jbird4k Send a message via Yahoo to jbird4k
bocmaxima, Kiteless

Thanks converting the date to ODBC format cleared up the the problem.


thanks again.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Date manipulation problems - returns do data


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