Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Columns of second query appears in diff order when use UNION.


Columns of second query appears in diff order when use UNION.

Author
Message
Joy Smith San
Joy Smith San
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2083 Visits: 3198
Hi All,

--- Results of first query

Server AppName Version
Srvr1 App1 6.1.1016
Srvr1 App2 6.1.1033
Srvr1 App3 5.7.216


--- Results of second query
Server AppName Version
Srvr2 App4 12.5



--- Results when I UNION the above 2 queries.
Server AppName Version
Srvr1 App1 6.1.1016
Srvr1 App2 6.1.1033
Srvr1 App3 5.7.216
12.5 Srvr2 App4


Why the last row columns (second query results) comes is diff order



Thanks in Advance.
Mr. Holio
Mr. Holio
SSC Eights!
SSC Eights! (849 reputation)SSC Eights! (849 reputation)SSC Eights! (849 reputation)SSC Eights! (849 reputation)SSC Eights! (849 reputation)SSC Eights! (849 reputation)SSC Eights! (849 reputation)SSC Eights! (849 reputation)

Group: General Forum Members
Points: 849 Visits: 2559
Hi,

Could you post that query?

__________________________
Allzu viel ist ungesund...
Joy Smith San
Joy Smith San
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2083 Visits: 3198
Thanks for your quick reply.

Problem resolved. First query is Grouped By "AppName"
and second query is Grouped By "Server".
When I made first query to be grouped by "Server, AppName' result is coming properly.

but, I am still not clear why should it make difference based on the group by columns. I dont understand.

Thanks.
WayneS
WayneS
SSCertifiable
SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)SSCertifiable (6.3K reputation)

Group: General Forum Members
Points: 6257 Visits: 10403
I'd really like to see the query you were running also... from what you've said, this shouldn't be happening. The proof is in the code. I'd be very appreciative if you would post it please.

Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings

Joy Smith San
Joy Smith San
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2083 Visits: 3198
Hi,
Thanks for your response.

I am sorry that I can't post the query here.
I tried to simulate the issue in test, but couldn't.
But beleive me, it's a strange problem. And one more thing...

When I simply quey using "UNION" this issue occurs.
But when I add "top 10 *" with same query, it just works fine.

Anyways, when I am free, will try to put those records in some dummy tables and simulate the same error so that I can show you the error.

Thanks again.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search