On Wednesday 17 January 2001 12:29, Tom Lane wrote:
> "Gordan Bobic" <gordan@freeuk.com> writes:
> > CREATE VIEW LastDate AS
> > SELECT Company,
> > max(Date) AS Date
> > FROM PastInvoices
> > GROUP BY Company;
> >
> > And then call it like
> > SELECT Date FROM LastDate ORDER BY Date WHERE Company = 'SomeCompany';
> >
> > It takes ABSOLUTELY forever. The table has about 25-30M records.
As long as you are selecting a specific company with that WHERE clause,
isn't that ORDER BY unnecessary?
--
-------- Robert B. Easter reaster@comptechnews.com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------