Jean-Christophe Deschamps wrote:
>> Yours returns 1 or 0. Mine returns length if found, otherwise 0.
>
> That's true but the subject title led me to believe that the OP
> intended to have a 0 vs. nonzero return for not-exists vs exists condition.
Perhaps. Nevertheless, the answer to your
>Yours returns 1 or 0. Mine returns length if found, otherwise 0.
That's true but the subject title led me to believe that the OP
intended to have a 0 vs. nonzero return for not-exists vs exists condition.
___
sqlite-users mailing list
Jean-Christophe Deschamps wrote:
>> Andrea Galeazzi wrote:
>>> I've got a table T made up of only two fields: INT id (PRIMARY KEY) and
>>> INT length.
>>> I need a statement in order to yield 0 when the key doesn't exist.
>>
>> Well, "select 0;" fits your spec (you never said what should be
>>
>Andrea Galeazzi wrote:
> > I've got a table T made up of only two fields: INT id (PRIMARY KEY) and
> > INT length.
> > I need a statement in order to yield 0 when the key doesn't exist.
>
>Well, "select 0;" fits your spec (you never said what should be
>returned when the key does exist). I
Andrea Galeazzi wrote:
> I've got a table T made up of only two fields: INT id (PRIMARY KEY) and
> INT length.
> I need a statement in order to yield 0 when the key doesn't exist.
Well, "select 0;" fits your spec (you never said what should be returned when
the key does exist). I would hazard a
It works fine!
Thanks!
Martin.Engelschalk ha scritto:
> Hi,
>
> try this:
>
> select coalesce(min(length), 0) from t where id = ?
>
> Martin
>
> Andrea Galeazzi schrieb:
>
>> Hi All,
>> I've got a table T made up of only two fields: INT id (PRIMARY KEY) and
>> INT length.
>> I need a
Hi,
try this:
select coalesce(min(length), 0) from t where id = ?
Martin
Andrea Galeazzi schrieb:
> Hi All,
> I've got a table T made up of only two fields: INT id (PRIMARY KEY) and
> INT length.
> I need a statement in order to yield 0 when the key doesn't exist. At
> this moment the query
Hi All,
I've got a table T made up of only two fields: INT id (PRIMARY KEY) and
INT length.
I need a statement in order to yield 0 when the key doesn't exist. At
this moment the query is too simple:
SELECT length FROM T WHERE id = ?
Any idea about it?
Cheers
8 matches
Mail list logo