[thelist] ASP.NET: UNION query not returning expected results

r937 rudy at r937.com
Thu Sep 27 16:31:45 CDT 2007


sorry, i don't understand the ASP "filter" part

if you remove WHERE E.id = 57 from the first SELECT, it will return all
offices which have at least one employee

if you then apply a filter after the result set has been returned, all
offices from the first SELECT except (maybe) one will be removed

this just seems ~so~ in line with microsoft's approach to things...

note that you can filter from one SELECT or the other ~only~ in the query, 
and ~not~ in the result set of the UNION, which contains the combined 
results

in the second SELECT, there's no point adding E.id because you know in
advance that it's going to be NULL

also, you cannot give it a different column name, because the column names
in a UNION query are all taken from the first SELECT


any more questions, please just ask


rudy





More information about the thelist mailing list