Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: scratch head to the SQL statement of where 1=1

Re: scratch head to the SQL statement of where 1=1

From: Katak <kahtat_at_yahoo.com>
Date: Fri, 7 Sep 2001 14:26:06 +0800
Message-ID: <9n9p8j$fld$1@dahlia.singnet.com.sg>


i mean on what grounds would a person issue

"where 1 = 1"

since this is always true?

"The Ghost" <The Ghost_at_home.com> wrote in message news:RYXl7.47591$w75.19589117_at_news3.rdc2.on.home.com...
> 1 = 1 returns true... generic statement
> if statement is generated based on conditions then
> and x = y statement can then be added without a problem
>
> ie
> select count(*) from table
> where 1 = 1
> and x = y
> and ... will be legit
>
> whereas
> select count(*) from table
> and x=y ... is not legit.
>
> "Katak" <kahtat_at_yahoo.com> wrote in message
> news:9n9er1$fbe$1_at_dahlia.singnet.com.sg...
> > dear all,
> >
> > i am having problems understanding a particular SQL statement
> > let me paint this scenario to u
> >
> > SQL statement 1 = select count(*) from mytable
> >
> > when SQL statement 1 is executed, the value returned is X for example.
> >
> > SQL SQL statement 1 = select count(*) from mytable where 1=1
> > this will also return a value of X.
> >
> > anyone can enlighten me on this? thanks
> > the database used is Oracle 8.1.7
> >
> >
> >
> >
>
>
Received on Fri Sep 07 2001 - 01:26:06 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US