How sort dataset with Sql Union in it?

  • Thread starter Thread starter needin4mation
  • Start date Start date
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.
 
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>
 
Back
Top