Re: Selecting non NULL values

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Sun, 31 Mar 2002 19:30:46 GMT
Message-ID: <GtJp8.167062$uA5.141286_at_rwcrnsc51.ops.asp.att.net>


I am assuming that todays_time is character and you want things that happen around noon.(assuming 24 hour clock)
select * from data where todays_time like '12:%' and todays_time is not null and todays_time!='';
haven't used && in an sql statement.

The way you had it then times like'1:12' would have been found, which may not be what you want. Also if you remove the first % then if you have an index on the todays_time field Oracle can use the index and avoid the full table scan.

Jim
"Ryn" <mattycruft_NO_at__SPAM_daemons.net> wrote in message news:5iJp8.40554$1f1.3189846_at_e3500-atl2.usenetserver.com...
> The actual select statement I am using is:
>
> select * from data where TODAYS_TIME like '%12%' && POSTINGS is not NULL;
>
> Postings is column 4 and TODAYS_TIME is column 2.
>
> Sorry about the bad data.
> Ryan
>
> "Ryn" <mattycruft_NO_at__SPAM_daemons.net> wrote in message
> news:AfJp8.40521$1f1.3189806_at_e3500-atl2.usenetserver.com...
> > Hello folks,
> >
> > I am trying to figure out why:
> >
> > select * from data where TODAYS_TIME like '%12%' && TODAYS_TIME is not
 NULL;
> >
> > does not work. I still get:
> >
> > 2002-03-19 12:00:01 Atlanta 786
> > 2002-03-20 12:00:00 Atlanta 777
> > 2002-03-21 12:00:00 Atlanta
> > 2002-03-22 12:00:00 Atlanta
> > 2002-03-23 12:00:00 Atlanta 783
> > 2002-03-30 12:00:00 Atlanta 745
> > 2002-03-31 12:00:01 Atlanta 736
> >
> > The last column in each line has an occasional NULL value.
> >
> > Thanks for any info,
> > Ryn
> >
> >
> >
>
>
>
Received on Sun Mar 31 2002 - 21:30:46 CEST

Original text of this message