• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Query of Query - union resorts the dataset?

New Here ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

It appears that when I try to union two queries, something is reordering everything. I have 2 separate queries that need to be unioned, but with the first query's results showing first, then the second queries results. This is ending up in a select list, so order is important.

How do I get around this behavior?
TOPICS
Advanced techniques

Views

302

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

> How do I get around this behavior?

Add a field to each record set with a value that distinguishes one set
from the other in the desired order. Then in the QofQ union add an
order by clause to the end that utilizes this field.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

I just figured that out. Thanks for the reply. Now if I could just keep it from reordering the contents of each set...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: Tinaja
It appears that when I try to union two queries, something is reordering everything. I have 2 separate queries that need to be unioned, but with the first query's results showing first, then the second queries results. This is ending up in a select list, so order is important.

How do I get around this behavior?

Think about what you are trying to accomplish. The statements, "need to be unioned" and "first query results showing first" contradict each other.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 18, 2007 Oct 18, 2007

Copy link to clipboard

Copied

LATEST
Actually it's all in your definition of "union" isn't it? I expected it meant concatenation. Obviously it doesn't :)

I got it worked out - thanks for the help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation