Friday, March 9, 2012

how to concatenate recordsets

is it possible to concatenate 2 recordsets ?

i have 2 select, and i need then to be displayed one after other.

using union all the results are gathered, ordered like only one select.


thanks for all

You can do this in your SQL query using a union, provided the schemas are identical.

In code, if you have two seoearet recordsets and want to join then, programatically create a datatable and add both these result sets to the new datatable by iterating over them.

Hope this helps
Chris

|||

UNION ALL is the what you need. Here is an introduction for UNION and UNION ALL:http://www.w3schools.com/sql/sql_union.asp

|||

ixxx:

is it possible to concatenate 2 recordsets ?

i have 2 select, and i need then to be displayed one after other.

using union all the results are gathered, ordered like only one select.


thanks for all

What I understod from post is, you asked a question and provided its answer at the same time!

Here is the questoin (you wrote):

ixxx:

is it possible to concatenate 2 recordsets ?

i have 2 select, and i need then to be displayed one after other.

and here is the answer you wrote as well (which is the correct answer :) ):

ixxx:

using union all the results are gathered, ordered like only one select.

I guess there is something missing that you need us to help you with (other than just the UNION).[just a guess becuase you asked the question and answered it in the same post!].

Anyway,,, we are here to help you.

Good luck.

I

|||

"using union all the results are gathered, ordered like only one select."

My guess what the OP means:

using union, all the results are gathered, ordered like only one select.

Not

using union all, the results are gathered, ordered like only one select.

|||

yes that is it

using union, all the results are gathered.

using union all, i get duplicated rows.

thanks for all

No comments:

Post a Comment