Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mi correggete questa where con IF?

0 views
Skip to first unread message

Peca's

unread,
Aug 28, 2008, 6:15:11 PM8/28/08
to
Così come l'ho scritta non mi visualizza nulla...

select * from tab1 where if (not
isnull(data_termine),'(DATEDIFF(now(),data_inizio) < 0) and
(DATEDIFF(now(),data_termine) > 0)','(DATEDIFF(now(),data_inizio) < 0)')

[cut]

dove sbaglio? Mi sembra scritta bene... "data_termine" è un datetime e
può essere NULL. Se ho campi null come posso risolvere?

Grazie!

Andrea [Work]

unread,
Aug 29, 2008, 4:01:21 AM8/29/08
to
Il Fri, 29 Aug 2008 00:15:11 +0200, Peca's ha scritto:

> Cosě come l'ho scritta non mi visualizza nulla...


>
> select * from tab1 where if (not
> isnull(data_termine),'(DATEDIFF(now(),data_inizio) < 0) and
> (DATEDIFF(now(),data_termine) > 0)','(DATEDIFF(now(),data_inizio) < 0)')
>
> [cut]
>

> dove sbaglio? Mi sembra scritta bene... "data_termine" č un datetime e
> puň essere NULL. Se ho campi null come posso risolvere?

Dovresti indicare anche il database che utilizzi.

Peca's

unread,
Aug 29, 2008, 10:21:36 PM8/29/08
to
> Dovresti indicare anche il database che utilizzi.

Scusa...MySQL 5.0

0 new messages