Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Add result of 1 query to result of another query

Author  Topic 

mail2panki
Starting Member

1 Post

Posted - 2011-05-27 : 18:46:39
I have two stored procedures/queries. Now i want to add the resulting rows of one query to result of another query as columns. How can i perform this in tsql?

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-05-27 : 19:44:00
You would need some way to "join" the result sets to tell you which row of the results from first query should be lined up against a given row of the results from the second query.

If you can post your queries and some sample data, someone on the forum should be able to offer more concrete suggestions. Brett's blog here has some information that might help you: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

jcelko
Esteemed SQL Purist

547 Posts

Posted - 2011-05-29 : 00:23:47
Please post real DDL. Learn to use ISO-11179 rules for the data element names, avoid needless dialect and use ISO-8601 temporal formats, codes and so forth. People cannot read your mind, so post your code and clear specs if you really want help.

You probably ought to write a new query to do this.

--CELKO--
Books in Celko Series for Morgan-Kaufmann Publishing
Analytics and OLAP in SQL
Data and Databases: Concepts in Practice
Data, Measurements and Standards in SQL
SQL for Smarties
SQL Programming Style
SQL Puzzles and Answers
Thinking in Sets
Trees and Hierarchies in SQL
Go to Top of Page
   

- Advertisement -