Using DISTINCT in queries

spako

Joined: 2005-07-02
Posts: 10
Posted: Sat, 2006-04-22 17:23

I'm building a search class for the module I'm developing. Because of the way the module is structured when I the count query will come back with duplicate ids and so produces an incorrect count sometimes. the way I've overcome this is to count DISTINCT item ids. i know this is a mysql command and it will probably work with some other databases but am not sure if it will work in all databases that Gallery wants to support. Can you let me know if it is OK to use DISTINCT and if not are there any other methods i can use to do this? i've grepped for DISTINCT (lowercase too) in the modules but didn't find any instancs of it, so assume that it won't be compatible with other databases.

 
technophile

Joined: 2003-02-17
Posts: 13
Posted: Thu, 2006-04-27 15:15

DISTINCT is a standard SQL keyword. I know it works in Oracle, SQL Server, MySQL and PostGRE, and it should work in most others as well.

 
spako

Joined: 2005-07-02
Posts: 10
Posted: Thu, 2006-04-27 20:53

coo, thanks!