List:General Discussion« Previous MessageNext Message »
From:Eric Bergen Date:October 17 2004 1:56am
Subject:Re: date time functions don't return not null rows
View as plain text  
Your tables aren't setup very well. You should google for
normalization and 'boyce codd normal form'

-Eric


On Sat, 16 Oct 2004 22:27:51 +0200, owca <owiec@stripped> wrote:
> I'm trying get current week, starting from monday to sunday:
> 
> select UNIX_TIMESTAMP(day), g15, g16, g17, g18, g19, g20, g21, g22, id
> from tydzien where to_days(day) between
>  to_days(now())- mod(to_days(now()),7)+2 /*some parameter setting a starting day*/
> and
> (to_days(now())- mod(to_days(now()),7))+8 /*ending day ^*/
> order by dzien;
> 
> it works!
> the table looks like this:
> +------------+------+------+------+------+------+------+------+------+----+
> | day        | g15  | g16  | g17  | g18  | g19  | g20  | g21  | g22  | id |
> +------------+------+------+------+------+------+------+------+------+----+
> | 1098128298 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |  5 |
> | 1098473898 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |  9 |
> | 1098560298 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 10 |
> | 1098646698 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 11 |
> +------------+------+------+------+------+------+------+------+------+----+
> 
> but it won't return the rows where any of columns g15, g16 etc has a value. eg
> 
> +------------+------+------+------+------+------+------+------+------+----+
> | day        | g15  | g16  | g17  | g18  | g19  | g20  | g21  | g22  | id |
> +------------+------+------+------+------+------+------+------+------+----+
> | 1098128298 | NULL | 5561 | NULL | NULL | NULL | NULL | NULL | NULL |  9 |
> | 1098473898 | NULL | NULL | NULL | 1111 | NULL | NULL | NULL | NULL | 10 |
> | 1098560298 | 2355 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 11 |
> +------------+------+------+------+------+------+------+------+------+----+
> 
> did i something wrong?
> 


-- 
Eric Bergen
eric.bergen@stripped
Thread
date time functions don't return not null rowsowca16 Oct
  • Re: date time functions don't return not null rowsEric Bergen17 Oct