Adobe Dreamweaver Forums



Last 10 THreads :         Screens get distorted (Last Post : Geetartha Kashyap - Replies : 0 - Views : 1 )           »          How large is Extremely large? (Last Post : SeaBream - Replies : 3 - Views : 4 )           »          Rate My Site Please (Last Post : Maneet Puri - Replies : 5 - Views : 6 )           »          screen readable output (section 508) (Last Post : Author care - Replies : 4 - Views : 5 )           »          Ini Flash component properties on beginSprite event (Last Post : DAVID NAJAR - Replies : 0 - Views : 1 )           »          Urgent - JavaScript to Shockwave problem !!! (Last Post : Ziggi - Replies : 0 - Views : 1 )           »          Can verity search pick up static and dynamic content? (Last Post : ssailer - Replies : 0 - Views : 1 )           »          Re: Duping (send to back) (Last Post : aneuryzma - Replies : 0 - Views : 1 )           »          Connecting to a Database (Last Post : Ronnie MacGregor - Replies : 6 - Views : 7 )           »          Need to print a particular chart from a page (Last Post : SujitG - Replies : 1 - Views : 2 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Cold Fusion
 
Tags:



Reply
  #1 (permalink)  
Old 10-01-2008, 04:00 AM
PopcornCoder
 
Posts: n/a
Diggs:
Default RecordCount for Queries Off - Please help.

Ok I have 8 queries the one below loops through the MYSQL database to get the
days of the week and then gets the results where they = 1 - 7 and outputs the
results using recordcount.

<cfloop index="i" from="1" to="7">
<cfquery name="dailycount#i#" datasource="123">
SELECT ct_id, ct_time, ct_email
FROM contacts
WHERE DayOfWeek(Right(ct_time, 10)) = #i#
GROUP By ct_email
</cfquery>
</cfloop>

Using that query I get the following numbers 24+26+22+38+27 = 137. Now when I
do a similar query here.

<cfquery name="DuringBusinessHours" datasource="123">
SELECT ct_id, ct_time, ct_email
FROM contacts
WHERE DayOfWeek(Right(ct_time, 10)) Between 2 AND 6
GROUP By ct_email
</cfquery>

My number is 134 which is off by 3 points. Anyone have any thoughts on this?



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 10-01-2008, 04:00 AM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

PopcornCoder wrote:
> <cfloop index="i" from="1" to="7">

....
> </cfloop>

....
> WHERE DayOfWeek(Right(ct_time, 10)) Between 2 AND 6

...

> My number is 134 which is off by 3 points. Anyone have any thoughts on this?


My first guess would be that there are three records that on Sundays or
Saturdays (1 or 7).

Your first query uses the values 1 through 7, your second only 2 through 6.


Reply With Quote
  #3 (permalink)  
Old 10-01-2008, 04:00 AM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

PopcornCoder wrote:
> <cfloop index="i" from="1" to="7">

....
> </cfloop>

....
> WHERE DayOfWeek(Right(ct_time, 10)) Between 2 AND 6

...

> My number is 134 which is off by 3 points. Anyone have any thoughts on this?


My first guess would be that there are three records that on Sundays or
Saturdays (1 or 7).

Your first query uses the values 1 through 7, your second only 2 through 6.


Reply With Quote


  #4 (permalink)  
Old 10-01-2008, 04:00 AM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

Sorry I forgot to mention. I have already taken out the saturday and sunday numbers.
Reply With Quote
  #5 (permalink)  
Old 10-01-2008, 04:00 AM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

Sorry I forgot to mention. I have already taken out the saturday and sunday numbers.
Reply With Quote
  #6 (permalink)  
Old 10-01-2008, 04:00 AM
-==cfSearching==-
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

PopcornCoder wrote:
> My number is 134 which is off by 3 points. Anyone have any thoughts on this?


I would first dump the results of all queries and compare them to determine
where the difference lies.

> DayOfWeek(Right(ct_time, 10))


What is the purpose of using Right()?

Reply With Quote


  #7 (permalink)  
Old 10-01-2008, 04:00 AM
-==cfSearching==-
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

PopcornCoder wrote:
> My number is 134 which is off by 3 points. Anyone have any thoughts on this?


I would first dump the results of all queries and compare them to determine
where the difference lies.

> DayOfWeek(Right(ct_time, 10))


What is the purpose of using Right()?

Reply With Quote
  #8 (permalink)  
Old 10-01-2008, 04:00 AM
-==cfSearching==-
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

What is the data type of the "ct_time" column?

PopcornCoder wrote:
> I do dump the numbers


No, dump the actual query objects:

<cfdump var="#DuringBusinessHours#">
.... etc...
Reply With Quote
  #9 (permalink)  
Old 10-01-2008, 04:00 AM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

Varchar and what does the cfdump do?
Reply With Quote


  #10 (permalink)  
Old 10-01-2008, 04:00 AM
PopcornCoder
 
Posts: n/a
Diggs:
Default Re: RecordCount for Queries Off - Please help.

Varchar and what does the cfdump do?
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 11:48 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk