Re: [SQL] Union Question

2010-12-03 Thread Jasen Betts
On 2010-12-03, Shaun McCloud wrote: > --_000_7742DD496427B743BC8B7BBF6D380BA0A2F114EXCHANGE10geocomm_ > Content-Type: text/plain; charset="us-ascii" > Content-Transfer-Encoding: quoted-printable > > Hello, > > I need to union three PostgreSQL tables and this won't be a problem but the= > tables a

[SQL] A note on how to generate a list of months within some period of time.

2010-12-03 Thread Michał Roszka
Hello, I am referring to an old message and it's follow-ups. Today I went through a similar problem and solved it in a different way. I would like to share my approach here to help others who might be searching for it. I think it is very simple and flexible. The old message is here: http://ar

Re: [SQL] Union Question

2010-12-03 Thread Shaun McCloud
Ah, ok. My bad for not reading good enough. Shaun McCloud - Software Testing Analyst GeoComm Inc. 601 W. Saint Germain St., Saint Cloud, MN 56301 Office: 320.240.0040 Fax: 320.240.2389 Toll Free: 888.436.2666 click here to visit www.geo-comm.com Microsoft Certified Desktop Support Technician (MCD

Re: [SQL] Union Question

2010-12-03 Thread Christophe Pettus
On Dec 3, 2010, at 9:08 AM, Shaun McCloud wrote: > That would be nice to see in the documentation for dblink It's true of all contrib modules; that's mentioned at the start of the contrib section: http://www.postgresql.org/docs/9.0/interactive/contrib.html -- -- Christophe Pettus x.

Re: [SQL] Union Question

2010-12-03 Thread Shaun McCloud
That would be nice to see in the documentation for dblink Shaun McCloud - Software Testing Analyst GeoComm Inc. 601 W. Saint Germain St., Saint Cloud, MN 56301 Office: 320.240.0040 Fax: 320.240.2389 Toll Free: 888.436.2666 click here to visit www.geo-comm.com Microsoft Certified Desktop Support Te

Re: [SQL] Union Question

2010-12-03 Thread Christophe Pettus
On Dec 3, 2010, at 9:04 AM, Shaun McCloud wrote: > I’m trying that, but I am getting an error that says “ERROR: function > dblink_connect(unknown, unknown) does not exist” dblink is a contrib module, and needs to be installed before use: http://www.postgresql.org/docs/9.0/interactive/

Re: [SQL] Union Question

2010-12-03 Thread Plugge, Joe R.
You may want to try dblink. http://www.postgresql.org/docs/current/static/dblink.html From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Shaun McCloud Sent: Friday, December 03, 2010 10:51 AM To: pgsql-sql@postgresql.org Subject: [SQL] Union Question Hell

Re: [SQL] Union Question

2010-12-03 Thread Shaun McCloud
I'm trying that, but I am getting an error that says "ERROR: function dblink_connect(unknown, unknown) does not exist" Shaun McCloud - Software Testing Analyst GeoComm Inc. 601 W. Saint Germain St., Saint Cloud, MN 56301 Office: 320.240.0040 Fax: 320.240.2389 Toll Free: 888.436.2666 click here t

[SQL] Union Question

2010-12-03 Thread Shaun McCloud
Hello, I need to union three PostgreSQL tables and this won't be a problem but the tables are on different servers. Basically, I have an administrative server that needs the tables viewable in a web administrator and three query servers that log the needed data locally. Is there a way I can d

Re: [SQL] COPY with FORMAT in Postgresql 9.x

2010-12-03 Thread Tom Lane
Humair Mohammed writes: > Postgres 9.x provies the COPY command with new syntax with a new option > called FORMAT > http://www.postgresql.org/docs/current/static/sql-copy.html > However when I run the following command: > COPY dQstn FROM 'c:/bcp/postgres/dQstn.csv' WITH FORMAT csv; > I get the fo

Re: [SQL] Get the max viewd product_id for user_id

2010-12-03 Thread Jayadevan M
Hello, > I went this way, but for a large number of user_id's, it's quite slow: > > CREATE VIEW v_views AS >SELECT user_id, product_id, count(*) as views >FROM viewlog >GROUP BY user_id, product_id > > SELECT >DISTINCT user_id, >(SELECT product_id FROM v_views inn WHERE inn.u

[SQL] Get the max viewd product_id for user_id

2010-12-03 Thread Mario Splivalo
I have a log-table where I record when some user_id has viewed some product_id: CREATE TABLE viewlog ( user_id integer, product_id integer, view_timestamp timestamp with time zone ) Now, I would like to get result that gives me, for each user_id, product_id of the produ