BareFeetWare-2 wrote: > > Then you can count the directors like this: > > select count(distinct People_ID) from "Movie People" join Capacity on > "Movie People".Capacity_ID = Capacity.ID where Capacity.Name = 'director'; > > or: > > select count(distinct People_ID) from "Movie People" where Capacity_ID = > (select ID from Capacity where Name = 'director'); > > or you can create a view [...] >
Thanks you but what I want to do is to count without using count(distinct col) because it is much slower than count(*). In the previous examples about tags I can do it, I have "movies" and "tags" related by "movies_tags" and I can do: SELECT count(*) FROM tags; I want to know if there is any standard approach to do that. The only thing I can think of is to have additional tables for the ids of all directors, all writers, etc... Tables "movies", "people", "capacity" and then tables "directors", "writers", etc.. with only the IDs so I can count using count(*) which is super fast. -- View this message in context: http://old.nabble.com/Speed-up-count%28distinct-col%29-tp30864622p30893712.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users