By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,481 Members | 1,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,481 IT Pros & Developers. It's quick & easy.

columns refered to in view

P: n/a
I have created a view with this query:

CREATE VIEW testview AS SELECT table.column AS col1, table2.column AS
coll2 FROM table, table2;

Later on, i want to get the table and column name that a field refers
to in this view. In other words i want to get the table and column that
the column 'col1' refers to. Im looking for 'table.column'. How can i
get this information?

thanks!
--
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
(819) 432-3443
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
On Wednesday 14 April 2004 14:59, Alexander Cohen wrote:
I have created a view with this query:

CREATE VIEW testview AS SELECT table.column AS col1, table2.column AS
coll2 FROM table, table2;

Later on, i want to get the table and column name that a field refers
to in this view. In other words i want to get the table and column that
the column 'col1' refers to. Im looking for 'table.column'. How can i
get this information?


If you're using 7.4, you can look in the information-schema:

SELECT * FROM information_schema.view_column_usage
WHERE view_name = 'foo_view';

This only lists columns that "show through" not calculated columns (AFAIK).
--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.