Solved

joning tables

Posted on 2004-09-20
7
230 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
  • 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 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to dynamically set the form action using jQuery.

831 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