From: Ian B. <ia...@co...> - 2004-09-13 23:01:10
|
Jeremy Fitzhardinge wrote: > On Fri, 2004-09-10 at 12:05 +0200, Marcin Wojdyr wrote: > >>Hi, >>I needed to answer question like this: >> >>-- How many people have at least one address with given zip >>SELECT COUNT(DISTINCT person.id) FROM person, address >>WHERE address.person_id = person.id AND address.zip = 50482 > > > I thought about this, but SQLite doesn't support the count(distinct ...) > syntax - you need to use a sub-select. So I punted and left it to stuff > which should be common to all databases. > > >>BTW, are there any plans to include distinct and index patches to SQLObject? > > > I haven't got any feedback about them. I guess I should stick them in > the SF patch manager... Sorry, I've been moving and haven't had good internet access. I'm still a little confused about what distinct really means. No two rows can be indistinct if you are including the primary key in the select. So what does distinct accomplish? If you could select a subset of the columns, then distinct would be useful. That could be useful, probably as another method (e.g., MyClass.selectColumns(['firstName', 'lastName'])); and there distinct would make sense. The index patch looks good and makes sense to me. -- Ian Bicking / ia...@co... / http://blog.ianbicking.org |