X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 748DE52999 for ; Wed, 8 Jun 2005 12:23:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61677-02 for ; Wed, 8 Jun 2005 15:23:13 +0000 (GMT) Received: from mx-00.sil.at (mx-00.sil.at [62.116.68.196]) by svr1.postgresql.org (Postfix) with ESMTP id A443752825 for ; Wed, 8 Jun 2005 12:23:08 -0300 (ADT) Received: (qmail-ldap/ctrl 4526 invoked from network); 8 Jun 2005 15:23:05 -0000 Received: from unknown (HELO io.sonorys.at) ([213.235.243.42]) (envelope-sender ) by mx-00.sil.at (qmail-ldap-1.03) with SMTP for ; 8 Jun 2005 15:23:05 -0000 Received: from neptun.sonorys.at (neptun.sonorys.at [172.24.1.17]) by io.sonorys.at (8.11.7+Sun/8.11.7) with ESMTP id j58FN7G07374 for ; Wed, 8 Jun 2005 17:23:07 +0200 (MEST) Received: by neptun.sonorys.at with Internet Mail Service (5.5.2653.19) id ; Wed, 8 Jun 2005 17:23:07 +0200 Message-ID: From: =?windows-1252?Q?K=D6PFERL_Robert?= To: pgsql-sql@postgresql.org Subject: Re: Cursor need it? Date: Wed, 8 Jun 2005 17:23:07 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.014 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/112 X-Sequence-Number: 21713 | |I am a new postgres user | |I want to get a list of tables from pg_tables where tables are like=20 |=91%wo%=92 (for example).. and then query that list =85. | |Select count(*) from tableVARIABLENAMEFROMFIRSTQUERY | |In SQL SERVER I can do that using cursor but in postgresql I don=92t=20 |understand how to use cursors Sorry, but this is a SQL-Server.=20 You are looking for cross table joins. Join the pg_class table (where = you get the table name) with another table which you want to query = additional data. Then select your columns off both tables. select p.name, m.foo from pg_class p JOIN myinfo m ON p.name=3Dm.info=20 this is equal to select p.name, m.foo from pg_class p, myinfo m where p.name=3Dm.info=20 | |Here is what I am trying to do |for each table on the list |Select tablename, count(*) tables from ( list of tables) | |tablename tables |table1 25 |table2 35 | |Any Idea would be appreciated | |Thanks | |Lucas | | |---------------------------(end of=20 |broadcast)--------------------------- |TIP 2: you can get off all lists at once with the unregister command | (send "unregister YourEmailAddressHere" to=20 |majordomo@postgresql.org) |