joning tables

Posted on 2004-09-20
Last Modified: 2010-04-06

I am writing a stored proc and it has two select statements.

wht i need is how to combine the two tables that are returned from the two select statements and display the combined table in the datagrid. Both the select statment tables have same data types. and the statements are parameterized statements. so i am not able to use the 'View' in this context.

is there any other possible solution for this.

Question by:sandeep437
  • 2
  • 2
LVL 21

Expert Comment

ID: 12107645
What web language are you using?

Author Comment

ID: 12108012
SQL server 2000
LVL 21

Expert Comment

ID: 12108663
If the two tables are in the same database, you can just join the two tables with a select statement:

SELECT,, books.title
        FROM publishers INNER JOIN books ON = books.publisher_id

The above SQL joins Publishers table with books table.

Accepted Solution

variant7 earned 250 total points
ID: 12110163
I think a UNION query will do the trick for you :

SELECT t1.field1 AS fld1, t1.field2 AS fld2 FROM table1 AS t1
SELECT t2.otherfield1 AS fld1, t2.otherfield2 AS fld2 FROM table2 AS t2

Author Comment

ID: 12111851
Hi Variant7

       yeah. UNION is working good in this situation.



Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP PDO get the error if exists 3 75
Create and populate iFrame onClick of a button? 1 66
Problem to page 4 75
Where do I learn ES6? 3 51
When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now