Re: Cursor need it?

Поиск
Список
Период
Сортировка
От KÖPFERL Robert
Тема Re: Cursor need it?
Дата
Msg-id ED4E30DD9C43D5118DFB00508BBBA76EB16752@neptun.sonorys.at
обсуждение исходный текст
Ответ на Cursor need it?  (Lucas Hernndez <lucashdz@gmail.com>)
Список 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@postgresql.org)
|


В списке pgsql-sql по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: How do write a query...
Следующее
От: Jay Parker
Дата:
Сообщение: access to new/old in dynamic sql for audit table