I have two select statements, both of which return two fields of information:
select a.something as [my_something], b.otherthing as [my_otherthing] from tableA a, tableB b where a.the_date > b.the_date
and
select a.something as [my_something], c.otherthing as [my_otherthing] from tableA a, tableC c where a.the_date > c.the_date
what I'd like to do is do a UNION of the two queries, and group the results based on [my_something]
I've tried to do this, but for some reason query analyzer complains no matter what I try.
How should this query be done? If you don't mind, I'd greatly appreciate sample code of how to group by of the two queries after they've been UNIONed.
Thanks in advance.
Karen
select a.something as [my_something], b.otherthing as [my_otherthing] from tableA a, tableB b where a.the_date > b.the_date
and
select a.something as [my_something], c.otherthing as [my_otherthing] from tableA a, tableC c where a.the_date > c.the_date
what I'd like to do is do a UNION of the two queries, and group the results based on [my_something]
I've tried to do this, but for some reason query analyzer complains no matter what I try.
How should this query be done? If you don't mind, I'd greatly appreciate sample code of how to group by of the two queries after they've been UNIONed.
Thanks in advance.
Karen