Re: [HACKERS] timestamp subtraction (was Re: [SQL] formatting intervals with to_char)

2007-02-20 Thread Bruce Momjian
One problem with removing justify_hours() is that this is going to return '24:00:00', rather than '1 day: test=> select '2004-01-02 00:00:00'::timestamptz - '2004-01-01 00:00:00'::timestamptz; ?column? -- 24:00:00 (1 row)

Re: [SQL] DISTINCT ON not working...?

2007-02-20 Thread Phillip Smith
This is a temporary table (with no indexes) that gets created in the same transaction block as the SELECT gets run, but I tried creating an index on the ean column anyway with no luck: CREATE INDEX ean_idx ON TMPTABLE USING btree (ean); SELECT DISTINCT ON (ean) ean, count(*) FROM

Re: [SQL] can someone explain confusing array indexing nomenclature

2007-02-20 Thread Bruce Momjian
Yes, it is confusing. I have an update to the array documentation that should clarify it --- attached. --- Achilleas Mantzios wrote: > ? 16 ??? 2007 20:35, ?/? chrisj ??: > > I am quite sure the [2]

Re: [SQL] DISTINCT ON not working...?

2007-02-20 Thread Marcin Stępnicki
Dnia Tue, 20 Feb 2007 15:36:32 +1100, Phillip Smith napisał(a): > Removing the CASE statement all together: > SELECT DISTINCT ON (ean) > ean, > count(*) > FROMTMPTABLE > WHERE code NOT IN (SELECT code FROM stock_deleted) > ANDean IS NOT NULL > GROUP BY ean > > Still gi