-
Query Results to a View
I have a table in a database that has very old and not very relational and I want to create a quick view to show the information in a better way. Let's say that the table has 4 fields : id , child1, child2, child3. I want to create a view from this table that will show two fields : id and child. So, my table currently looks like this:
id child1 child2 child3
1 sam bob chris
and i would like it like this......
id child
1 sam
1 bob
1 chris
Can anybody help me? Thanks in advance,
Bob
-
How about this
select id, child1
from table1
union all
select id, child2
from table1
union all
select id, child3
from table1
order by id
-
If you're going to make a view of it, you'll either have to leave off the Order By clause or use top in your Select clause.
select Top 100 Percent id, child1
from table1
union all
select Top 100 Percent id, child2
from table1
union all
select Top 100 Percent id, child3
from table1
order by id
-
thank you both for your help.....worked well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|