Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

joning tables

Posted on 2004-09-20
7
Medium Priority
?
249 Views
Last Modified: 2010-04-06
Hi

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.

Thanks
sandeep
0
Comment
Question by:sandeep437
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 21

Expert Comment

by:MogalManic
ID: 12107645
What web language are you using?
0
 

Author Comment

by:sandeep437
ID: 12108012
SQL server 2000
0
 
LVL 21

Expert Comment

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

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


The above SQL joins Publishers table with books table.
0
 
LVL 2

Accepted Solution

by:
variant7 earned 1000 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
UNION
SELECT t2.otherfield1 AS fld1, t2.otherfield2 AS fld2 FROM table2 AS t2
0
 

Author Comment

by:sandeep437
ID: 12111851
Hi Variant7

       yeah. UNION is working good in this situation.

thanks

sandeep
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to count occurrences of each item in an array.

721 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