Re: Cursor need it?

From: KÖPFERL Robert <robert(dot)koepferl(at)sonorys(dot)at>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Cursor need it?
Date: 2005-06-08 15:23:07
Message-ID: ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

|
|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(at)postgresql(dot)org)
|

Browse pgsql-sql by date

  From Date Subject
Next Message Jay Parker 2005-06-08 15:54:12 access to new/old in dynamic sql for audit table
Previous Message Bruno Wolff III 2005-06-08 14:47:41 Re: How do write a query...