Re: [sqlite] SELECT (...) GROUP BY not returns!

2005-04-09 Thread Adam Dziendziel
Ken & Deb Allen wrote: Using the GROUP BY changes this, and the query will attempt to return one record for each "towar" value that matches the selection criteria; since there are none, no records are returned. When using a COUNT(*) and a GROUP BY together, one normally includes the GROUP BY co

Re: [sqlite] SELECT (...) GROUP BY not returns!

2005-04-09 Thread Adam Dziendziel
[EMAIL PROTECTED] wrote: COUNT(*) returns NULL if there are no records selected. Change the query like this to accomplish what you're looking for: SELECT COALESCE(COUNT(*), 0) FROM drzewo_towar WHERE lft > 13 AND rgt < 14 GROUP BY towar; Thanks! But it's a bit strange - if I r

[sqlite] SELECT (...) GROUP BY not returns!

2005-04-08 Thread Adam Dziendziel
When I execute: SELECT COUNT(*) FROM drzewo_towar WHERE lft > 13 AND rgt < 14 GROUP BY towar on the table: CREATE TABLE drzewo_towar ( id INTEGER PRIMARY KEY, nazwa TINYTEXT, towar INTEGER, lft INTEGER, rgt INTEGER, dpt INTEGER ); INSERT INTO "drzewo_