J
joave
Hi:
I am using a query of two queries - those 2 queries come up with the same
4 columns. Here is my problem - the first query determines which people have
sent a certain thing and connected it, counts how many were sent and
connected (different columns), and puts them in order by how many they sent
and then how many they connected.
The table itself has one entry each time someone sends one (with a column
for connected, but no column for sent - they only get in the table if it was
sent - this is the cause of my issue but I have no control over the raw
data!)
The second query determines what people from the same tables do not have
any of that thing sent or connected (a zero query per se). I am trying to
put the data in the same order between the two individual queries but am not
having any luck. This is because you cannot ORDER BY from both queries in the
union, only one of them. Therefore the data from the second table is ending
up in the middle of this query instead of at the end (should be at the end
because they are all zeroes).
Here is the query of queries:
SELECT ID, Name, Sent, Connected from Location1MonthlyQuery
UNION ALL SELECT ID, Name, Sent, Connected from Location1ZeroSentQuery
ORDER BY Location1MonthlyQuery.Sent DESC, Location1MonthlyQuery.Connected;
Any help would be appreciated.
Thank you,
Dave
I am using a query of two queries - those 2 queries come up with the same
4 columns. Here is my problem - the first query determines which people have
sent a certain thing and connected it, counts how many were sent and
connected (different columns), and puts them in order by how many they sent
and then how many they connected.
The table itself has one entry each time someone sends one (with a column
for connected, but no column for sent - they only get in the table if it was
sent - this is the cause of my issue but I have no control over the raw
data!)
The second query determines what people from the same tables do not have
any of that thing sent or connected (a zero query per se). I am trying to
put the data in the same order between the two individual queries but am not
having any luck. This is because you cannot ORDER BY from both queries in the
union, only one of them. Therefore the data from the second table is ending
up in the middle of this query instead of at the end (should be at the end
because they are all zeroes).
Here is the query of queries:
SELECT ID, Name, Sent, Connected from Location1MonthlyQuery
UNION ALL SELECT ID, Name, Sent, Connected from Location1ZeroSentQuery
ORDER BY Location1MonthlyQuery.Sent DESC, Location1MonthlyQuery.Connected;
Any help would be appreciated.
Thank you,
Dave