[SQL] unsubscribe

2007-03-14 Thread Stefan Ionita
unsubscribe _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ---(end of broadcast)--- TIP 3

Re: [SQL] Joins on many-to-many relations.

2007-03-14 Thread Wiebe Cazemier
On Wednesday 14 March 2007 18:58, Frank Bax wrote: > A performance question should always include the output of EXPLAIN ANALYZE. > > I think the problem is database design. If you added a boolean column into > accounts table which would indicate owner/co-owner; then all data from > account_co_own

[SQL]

2007-03-14 Thread Nigel Henry
Unsubscribe Nigel Derek Henry [EMAIL PROTECTED] eBusiness Architect

[SQL]unsubscribe

2007-03-14 Thread Stefan
unsubscribe ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] Joins on many-to-many relations.

2007-03-14 Thread Frank Bax
At 11:39 AM 3/14/07, Wiebe Cazemier wrote: Consider this scenario of three (simplified) tables: people - id - name accounts - id - owner_id REFERENCES people account_co_owners - co_owner_id REFERENCES people - account_id REFERENCES accounts I need a query that allows the user to search for ac

Re: [SQL] ordering by multiple columns

2007-03-14 Thread Rodrigo De León
On 3/14/07, Pablo Barrón <[EMAIL PROTECTED]> wrote: Hi! I'm trying to order a list in which the first parameter to order is a specific field, and the second should vary depending on a specific condition. More explicit, I would like to do something like: - ORDER BY a.column1, [b.column2 if c.

Re: [SQL] ordering by multiple columns

2007-03-14 Thread Andreas Kretschmer
Pablo Barrón <[EMAIL PROTECTED]> schrieb: > > Hi! > > I'm trying to order a list in which the first parameter to order is a > specific > field, and the second should vary depending on a specific condition. More > explicit, I would like to do something like: > > - ORDER BY a.column1, [b.colu

Re: [SQL] import CSV file

2007-03-14 Thread Andrew Sullivan
On Tue, Mar 13, 2007 at 11:52:17PM +, T E Schmitz wrote: > Also, it's nopt happy about the date format : 2007/02/09 You may need to fiddle with your date style. It works for me on 8.1: SELECT '2007/02/09'::date; date 2007-02-09 (1 row) A -- Andrew Sullivan | [EMAIL

[SQL] ordering by multiple columns

2007-03-14 Thread Pablo Barrón
Hi! I'm trying to order a list in which the first parameter to order is a specific field, and the second should vary depending on a specific condition. More explicit, I would like to do something like: - ORDER BY a.column1, [b.column2 if c.value != 19 || c.column2 if c.value==19] That is to say

[SQL] Joins on many-to-many relations.

2007-03-14 Thread Wiebe Cazemier
Hi, Doing a join on one-to-many relations (like "orders" joining "custumors") is easy, but what if there are many-to-many relations involved? Consider this scenario of three (simplified) tables: people - id - name accounts - id - owner_id REFERENCES people account_co_owners - co_owner_id REFER

Re: [SQL] import CSV file

2007-03-14 Thread T E Schmitz
T E Schmitz wrote: Rodrigo De León wrote: On 3/13/07, T E Schmitz <[EMAIL PROTECTED]> wrote: This is pretty ingenious! Just a few minor problems: - how does COPY know which column is which? - how do I specify DELIMITER as TAB? See: http://www.postgresql.org/docs/8.2/static/sql-copy.html

Re: [SQL] import CSV file

2007-03-14 Thread T E Schmitz
Rodrigo De León wrote: On 3/13/07, T E Schmitz <[EMAIL PROTECTED]> wrote: This is pretty ingenious! Just a few minor problems: - how does COPY know which column is which? - how do I specify DELIMITER as TAB? See: http://www.postgresql.org/docs/8.2/static/sql-copy.html Thank you for the lin

Re: [SQL] How to declare cursor if tablename is a variable?

2007-03-14 Thread Michael Fuhr
On Wed, Mar 14, 2007 at 08:14:07AM +, hu js wrote: > CREATE or replace function geo_polygon(tablename varchar) RETURNS > [...] >cur_obj CURSOR FOR SELECT mrc_xy_position FROM tablename; >cur_point CURSOR FOR SELECT x,y FROM tablename where mrc_xy_position = > objectid; > > Error

Re: [SQL] reindex database

2007-03-14 Thread Achilleas Mantzios
Στις Τετάρτη 14 Μάρτιος 2007 14:44, ο/η Sabin Coanda έγραψε: > Hi, > > It would be so nice to use REINDEX DATABASE command without name, for the > current database. > Now the command is useless when a database schema script refers just > itself, and the database name is not establish. I have to use

[SQL] reindex database

2007-03-14 Thread Sabin Coanda
Hi, It would be so nice to use REINDEX DATABASE command without name, for the current database. Now the command is useless when a database schema script refers just itself, and the database name is not establish. I have to use REINDEX TABLE name instead searching all the database tables. What

[SQL] How to declare cursor if tablename is a variable?

2007-03-14 Thread hu js
See this: “CREATE or replace function geo_polygon(tablename varchar) RETURNS integer AS $$ DECLARE objectid varchar; tab varchar; x1 float; y1 float; obj_num integer; point_num integer; polygonstr varchar; cur_obj CURSOR FOR SELECT mrc_xy_position FROM tablename