![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
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? |
| Sponsored Links |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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()? |
|
|||
|
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()? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise