I often need to compare the results from two queries and concantinate and resort them to formulate a single list. I usually do this with two seperate queries and then I work on the resulting record sets in the programming language, but is it possible to return a single result to avoid that, but at the same time weeding out duplicates?
For instance, two queries return the following. Picture these as the results of of a much larger query, perhaps returning all the logged entries for a certain city on a certain date, etc.. One returns the north east and the other specific cities..
"Foo" Halifax, Boston, Yarmouth
"Bar" Boston, Chicago, Oakland
and I want:
"Result" Halifax, Boston, Yarmouth, Chicago, Oakland
The problem is that these are usually the products of more complex queries, and there may be no common key, so I'm not sure how to do a join based solely on the results of a select statment.
For instance, two queries return the following. Picture these as the results of of a much larger query, perhaps returning all the logged entries for a certain city on a certain date, etc.. One returns the north east and the other specific cities..
"Foo" Halifax, Boston, Yarmouth
"Bar" Boston, Chicago, Oakland
and I want:
"Result" Halifax, Boston, Yarmouth, Chicago, Oakland
The problem is that these are usually the products of more complex queries, and there may be no common key, so I'm not sure how to do a join based solely on the results of a select statment.