470,647 Members | 1,099 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

complex views

I want to create a rule that transforms a query on one table to a query on
many with table names and columns named after one of the columns in the fake
table.

e.g.:

select a,b,c from foo where b='x.1' or b='y.1' or b='y.2';

to:

select a,'x.1',c from foo_x union
select a,'y.1',c from foo_y union
select a,'y.2',c from foo_y;

But it doesn't seem that I can manipulate the column data into table names
when I do it in a rule.

How can I do this?
Jul 19 '05 #1
1 1750
tr*****@yahoo.com (Thomas Reat) wrote in message news:<3c**************************@posting.google. com>...
to:

oops, I mean:

select a,'x.1',c from foo_x where foo_x.a=foo.a and b='1' union
select a,'y.1',c from foo_y where foo_y.a=foo.a and b='1' union
select a,'y.2',c from foo_y where foo_y.a=foo.a and b='2';
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Alex | last post: by
8 posts views Thread by Mike N. | last post: by
1 post views Thread by Michel Laan | last post: by
3 posts views Thread by dbtoo_dbtoo | last post: by
3 posts views Thread by KemperR | last post: by
33 posts views Thread by Peter | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.