How sort dataset with Sql Union in it?

N

needin4mation

Hi, I have a select that uses union. The gridview populates fine with
the two tables' returned data. But now I want to sort the resulting
dataset as if it were one set of data, since I know of no way to use
order by for both on my original SQL statement. If I use sort that
comes with the gridview, does that go back and get the whole dataset
(thus my problem would remain?). What can I do? thanks for any help.
 
M

Mark Rae

Hi, I have a select that uses union. The gridview populates fine with
the two tables' returned data. But now I want to sort the resulting
dataset as if it were one set of data, since I know of no way to use
order by for both on my original SQL statement. If I use sort that
comes with the gridview, does that go back and get the whole dataset
(thus my problem would remain?). What can I do? thanks for any help.

SELECT * FROM Table1
UNION
SELECT * FROM Table2
ORDER BY <name of field(s) from either table>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top