From: Arno B. <fbd...@ab...> - 2006-12-06 13:28:49
|
Hi, > I often use it with lazy loading - first I only load PK values in some > order, ie > SELECT DISTINCT PK FROM Customers WHERE(..) ORDER BY Name > and later when I need details I use the PK to load full record. It > would be overkill to include ordering fields into original query's > select list. The DISTINCT is overkill here, because the PK is unique. This would be fine: SELECT PK FROM Customers WHERE(..) ORDER BY Name but this isn't: SELECT DISTINCT PK FROM Customers WHERE(..) ORDER BY Name Be prepared that the query will raise an error in the future! So change it to a correct query. In fact DISTINCT <list> and GROUP BY <list> are the same. You'll see that with GROUP BY an error is thrown. Regards, Arno Brinkman ABVisie -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- General database developer support: http://www.databasedevelopmentforum.com Firebird open source database (based on IB-OE) with many SQL-99 features: http://www.firebirdsql.org http://www.firebirdsql.info Support list for Interbase and Firebird users: fir...@ya... Nederlandse firebird nieuwsgroep: news://newsgroups.firebirdsql.info |