pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: KÖPFERL Robert <robert.koepferl@sonorys.at>
To: pgsql-sql@postgresql.org
Subject: Re: Cursor need it?
Date: Wed, 8 Jun 2005 17:23:07 +0200
Message-ID: <ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at> (raw)



|
|I am a new postgres user
|
|I want to get a list of tables from pg_tables where tables are like 
|‘%wo%’ (for example).. and then query that list ….
|
|Select count(*) from tableVARIABLENAMEFROMFIRSTQUERY
|
|In SQL SERVER I can do that using cursor but in postgresql I don’t 
|understand how to use cursors

Sorry, but this is a SQL-Server. 
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=m.info 
this is equal to
select p.name, m.foo from pg_class p, myinfo m  where p.name=m.info 

|
|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 
|broadcast)---------------------------
|TIP 2: you can get off all lists at once with the unregister command
|    (send "unregister YourEmailAddressHere" to 
|majordomo@postgresql.org)
|



view thread (2+ messages)

Message-ID: <ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at>
Permalink:  ../ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at/
Also on:    postgresql.org/message-id/ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: robert.koepferl@sonorys.at
  Subject: Re: Cursor need it?
  In-Reply-To: <ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at>
  References: <ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox