Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread José Isaías Cabrera
I agarre.  Mensaje original De: R Smith <rsm...@rsweb.co.za> Fecha: 5/9/17 4:11 PM (GMT-05:00) A: sqlite-users@mailinglists.sqlite.org Asunto: Re: [sqlite] Getting number of rows with NULL On 2017/09/05 10:00 PM, Stephen Chrzanowski wrote: > On behalf of Cecil,

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
2017-09-05 22:46 GMT+02:00 R Smith : > > > On 2017/09/05 10:13 PM, John McKown wrote: > >> On Tue, Sep 5, 2017 at 3:00 PM, Stephen Chrzanowski >> wrote: >> >> On behalf of Cecil, the fault in that logic is that count(*) returns the >>> number of rows in

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread R Smith
On 2017/09/05 10:13 PM, John McKown wrote: On Tue, Sep 5, 2017 at 3:00 PM, Stephen Chrzanowski wrote: On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
2017-09-05 22:09 GMT+02:00 Igor Tandetnik : > It's possible I misunderstand what it is the OP is trying to do. But in > any case, the query I show is equivalent to the query the OP has shown > (which, apparently, does what they want), except formulated in a less > roundabout

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Igor Tandetnik
On 9/5/2017 4:05 PM, Igor Tandetnik wrote: On 9/5/2017 4:00 PM, Stephen Chrzanowski wrote: select count(*) from teaInStock where "Last Used" IS NULL; On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: 

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread John McKown
On Tue, Sep 5, 2017 at 3:00 PM, Stephen Chrzanowski wrote: > On behalf of Cecil, the fault in that logic is that count(*) returns the > number of rows in that table, not whether there is a hole "somewhere: Your > query will either return 1, or, 0. > > ​I either don't

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread R Smith
On 2017/09/05 10:00 PM, Stephen Chrzanowski wrote: On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either return 1, or, 0. Perhaps this is the opportune moment to learn. Test the

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Stephen Chrzanowski
As I understand the requirements, he wants to find out how many entries (Not which entries) don't exist between the first ID (Assumed 1) and max ID value. So if he's got 3 rows, but max ID is 5, the result should be 2. But I also suspect you're better in tune with the requirements, since I

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
2017-09-05 21:55 GMT+02:00 Igor Tandetnik : > On 9/5/2017 3:45 PM, Cecil Westerhof wrote: > >> It is not very important, but I am just curious. I need to know how many >> records are not yet used. I do that with: >> SELECT COUNT(*) - COUNT("Last Used") AS "Not Used" >> FROM

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Igor Tandetnik
On 9/5/2017 4:00 PM, Stephen Chrzanowski wrote: select count(*) from teaInStock where "Last Used" IS NULL; On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either return 1, or, 0.

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Stephen Chrzanowski
On behalf of Cecil, the fault in that logic is that count(*) returns the number of rows in that table, not whether there is a hole "somewhere: Your query will either return 1, or, 0. On Tue, Sep 5, 2017 at 3:55 PM, Igor Tandetnik wrote: > On 9/5/2017 3:45 PM, Cecil

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Igor Tandetnik
On 9/5/2017 3:45 PM, Cecil Westerhof wrote: It is not very important, but I am just curious. I need to know how many records are not yet used. I do that with: SELECT COUNT(*) - COUNT("Last Used") AS "Not Used" FROM teaInStock Is that the correct way, or is there a better way? Why not be

Re: [sqlite] Getting number of rows with NULL

2017-09-05 Thread Stephen Chrzanowski
Untested (Obviously as I don't have your schema) select max(WheverYourIDFieldIs)-count(WhateverYourIDFieldIs) as "Not Used" from teaInStock group by WhateverYouIDFieldIs On Tue, Sep 5, 2017 at 3:45 PM, Cecil Westerhof wrote: > It is not very important, but I am just

[sqlite] Getting number of rows with NULL

2017-09-05 Thread Cecil Westerhof
It is not very important, but I am just curious. I need to know how many records are not yet used. I do that with: SELECT COUNT(*) - COUNT("Last Used") AS "Not Used" FROM teaInStock Is that the correct way, or is there a better way? -- Cecil Westerhof