time question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • time question

    Hi, it's me again

    here's my question for today:

    the query : $queryD = "SELECT round(sum(issiusta)/1024/1024) from statistika where vardas='".$login."' and YEAR(data)=".$this_year." and MONTH(data)=".$this_month." and HOUR(laikas) > 9 and HOUR(laikas) < 20";

    shows me the info of this year, this month and between 9 and 20 h.

    bet if i also need to know the info recorded between 20 and 9 h???

    if i write and HOUR(laikas) > 21 and HOUR(laikas) < 9 it doesn't work, and if i write HOUR(laikas) > 21 or HOUR(laikas) < 9 it gives me like ~40000 Mbytes instead of ~100

  • #2
    PHP Code:
    $queryD "SELECT round(sum(issiusta)/1024/1024) from statistika 
    where vardas='"
    .$login."' and YEAR(data)=".$this_year." and MONTH(data)=".$this_month." and 
    ((HOUR(laikas) >=20 and HOURS(laikas)<=24) 
    or  (HOURS(laikas)>0 and HOUR(laikas) <=9))"

    maybe this will do it

    i think there's still plenty room for opütimization but first test if it works
    Ich denke, also bin ich. - Einige sind trotzdem...

    Comment


    • #3
      hmmm... i'm still receiving NULL :/ i know 100 % that there shouldn't be NULL

      Comment


      • #4
        PHP Code:
         ... WHERE DATE_FORMAT(data"%Y %m") = DATE_FORMAT(NOW(), "%Y %m")
        AND 
        NOT
        (HOUR(dataBETWEEN 9 AND 20
        Last edited by graf; 20-03-2003, 18:04.

        Comment

        Working...
        X